Refresh data in application after database data has changed

#1

Hi,

I have a Java program that can manage and create some Person objects. When I start my application and I want to add a person with the same national number as a person already in the database, my program has to block the creation.

So far so good. Now... I have a person in my database with the same national number as a person I want to add. However when I change the value of the national number in the database explorer when the program is running and I want to recreate the person, he keeps saying the duplicate national number. How can I fix it so that when my program is going to create a new Person object, he first refreshes his internal "cache" or internal "objects"?

#2

Please provide the exact error message that you get from ObjectDB.

If the national number is a primary key you can only persist a single object per national number. Then you can update the object. After removing that object you will be able to create a new object with that specific national number.

ObjectDB Support

Reply