Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
  • 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
Posts: 17346
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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.

Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic