If you modify an ObjectDB Entity class will it be supported by a database set up using the old class?

StackOverflow https://stackoverflow.com/questions/22264925

  •  11-06-2023
  •  | 
  •  

Question

I have an ObjectDB database used in my Java application which just contains loads of one type of class, let's call it Record.

I want my program to be open/extensible, so say someone modified the Record class, and adds another field/variable, what will happen if the program attempts to store an object of this new type in my database containing the previous class? Does it just not work? If so, is there a way to possibly modify all the existing Records and just add a default value for them into the new field (e.g. 0).

Thanks in advance!

Was it helpful?

Solution

ObjectDB implements an automatic schema evolution mechanism that enables transparent use of old entity objects after schema change. When an entity object of an old schema is loaded into memory it is automatically converted into an instance of the up to date entity class. Obviously you can persist instances of the modified class after the schema change.

See this page in ObjectDB manual for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top