ObjectDB ObjectDB

How to enable and disable auto schema update?

#1

Hello,
Can I enable and disable the auto schema update? In some cases if multiple applications are using same database and mistakenly one of application uses entity of older version build(my specified entity libs) then the whole db is being corrupted and db need to be restart. 
Expected : Instate of updating the schema with old library db should throw some error and data should not corrupt. 
 

Thank you

 

Manoj Kumar Maharana
edit
delete
#2

There are 2 undocumented system properties that you can use:

To disable any schema upgrade:

System.setProperty("objectdb.temp.no-schema-upgrade", "true")'

To disable switching back to one of the previous versions (but allowing upgrade):

System.setProperty("objectdb.temp.no-schema-downgrade", "true");

Set the relevant property before accessing ObjectDB, or as a JVM parameter (using -D).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete
#3

Thank you for the response. 

System.setProperty("objectdb.temp.no-schema-upgrade", "true")' 

is working perfectly but the am not able get second one (

System.setProperty("objectdb.temp.no-schema-downgrade", "true"))

can you please explain how can i demonstrate it.

> Set the relevant property before accessing ObjectDB, or as a JVM parameter (using -D) -  can you send me the command?

Thank you

Manoj Kumar Maharana
edit
delete
#4

The second setting is expected to stop ObjectDB from returning to a list of fields that was used in a previous schema version. The fields are identified by their names only. If you add a new persistent field and use the new class with ObjectDB but then try accessing ObjectDB with the previous class then it will not remove the field as ObjectDB will identify it as an old schema. Anyway, this is not a supported feature. Use it if it works.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete
#5

Ok thank you for the response. 

 

>or as a JVM parameter (using -D). - can you please send the command. am using the following command but it is not working.

java -Djava.objectdb.temp.no-schema-upgrade=true -jar objectdb.jar -console

 

Thank you.

Manoj Kumar Maharana
edit
delete
#6

Try:

    java -Dobjectdb.temp.no-schema-upgrade=true ...
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete
#7

No this is also not working. am attaching the source files for your reference.
Here my Entity is Person am upgrading the field from FullName to Name but its upgrading the schema rather throwing exception but if am using 

System.setProperty("objectdb.temp.no-schema-upgrade", "true") in code its working fine. 
 

But i wants to implement in jvm label so that it will work for every db client.

I'm using following command to start objectdb which is not working
java -Dobjectdb.temp.no-schema-upgrade=true -jar objectdb.jar -console

Manoj Kumar Maharana
edit
delete

Reply

To post on this website please sign in.