Forums Register Login

ORM Newbie queston: How to persist my OM without redundancy ???

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Hibernate is the most common. I think it is the best way to go. But there are other solutions.

1. Other Orm tools like ObjectRelationalBridge
2. JDO
3. Entity Beans
4. Code your own JDBC.

Mark
I wasn't selected to go to mars. This tiny ad got in ahead of me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 815 times.
Similar Threads
Mapping Classes to Tables
Model question
convert Data Model to Object Model
Which XML technique to use?
Is ORM suitable for *big* apps ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:33:49.