• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic