In my REST application, when the JSON structure is provided through POST call to update properties of the objects, we have to make sure that all the properties are in the JSON structure. Otherwise, in the Hibernate layer, it gets inserted null value to objects.
After getting the JSON structure, the application makes a database call to retrieve the object that needs to modify and then, prepare them to a collection for Hibernate batch update. Which is another session
.
The problem is we need to provide fields that only need to update from JSON structure and leave the rest of the fields as it is. Retrieving and updating happen in two different sesions. How to solve this problem?