Hi all,
I am a novice at this topic and have a very urgent problem...
I have developed a Java/Swing application around a MVC architecture using an Object Model to hold my data in a redundancy-free way. Some of the objects holds collections of other objects, but every piece of the data is actually stored in one and only one object.
This is pretty straightforward. Because I needed a quick way of persisting my data, I used XStream to persist my complete OM as XML (ok, not as one XML file but a separate XML file for each of the leading OM classes).
This works, but I noticed that redundancy is created in those XStream XML files. Not strange, because in fact it is nothing else than serializing each object using a deep-copy strategy.
This is not acceptable, because modifications in object A are not reflected in object B holding a collection of object A, beause object B is serialized using its own copies of object A ! So when reading in my OM from the serialized XML files, the associations are in fact not anymore associations, but copies are created.
I guess that serialization is not the way to persist an object model with associations and aggregations... so I think of switching to some kind of ORM.
Probably this is a very trivial issue. But I have no good idea where to start... Is Hibernate the way to success ? Are there any other simple options ?
I hope for some good hints !
Best regards, Klaas