Historical Data and modified objects
My application receives object trees from a JMS topic, and must persist only those objects that have changed for historical purposes.
If, for example, it receives an object tree with objects A, B, C (which already exist in the database according to their ids) in this hierarchical order (A contains B which contains C), but only object C has changed, only that object will be stored in the database, creating a new entry for historical purposes.
What solution is best for this approach? What technologies (Hibernate, JPA) can help me achieving this?
Here are two fundamentally different approaches to get you started.
Insert the object tree temporary in a table in the database, and then run a stored procedure to do the historical analysis.
Pull out the matching object tree from the database and then determine what to do in your code.
The typical depth of your tree, whether most jms objects result in a change, the rate at which you receive objects, the difficulty of how to detect a change, whether the same objects are sent repeated or not, are all things that will affect the best design choice.
After that, you should worry about what technology to go with.