I am new to perseverance and I want to do the following:
1) Download the database part in essence and save them in a file
2) Download these objects from the file, put them in a controlled context (so that all @JoinColumn and @JoinTable, especially those that have a lazy fetch type, will work fine) and make sure that I don't accidentally update their database.
The point is that every time I run the application, I do not want to call the database for a table that almost never changes - so I want to store them locally, preferably in a file.
Although part 1) was pretty simple, I have some problems regarding part 2). I realized that loadObject and em.persist () will work fine if I don't allow em.flush ().
But at some point I would like to check if the object in the database has changed. If I call persist () on my de-serialized object and at the same time change the database, after you leave this version?
Is there a better way to do this?
source share