Schema evolution & renamed/moved enum



I have an entity with an attribute of type enum say com.pkg1.MyEnum. I created a few instances of the class with this attribute of type com.pkg1.MyEnum and stored them in the database.

Now, I moved that enum to a different package and renamed it say com.pkg2.MyNewEnum, which is not the new type of my attribute. When I open my database again, the attribute is null. I don't seem to be able to use the <schema> tag in the config file because my enum is not an entity.

What is a the proper way of handling the migration?




It seems that in this case automatic schema evolution is currently not supported.

If you have to update a field type into a non convertible type, you can add a new field (with a different field name) with the new type and on PostLoad convert the old field value to the new one.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Thanks, I guess I need to persist the changes after that?


Yes, make the updates within an active transaction and commit.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)



Post Reply

To post a reply and/or subscribe to update notifications - please login