Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which is a better ORM design? (hibernate)

 
ayan sevi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Just a bit curious on this one, though I have also my own thoughts, since I'm new to ORM, I'd like to hear from you guys who have already gone through the ORM dev and design.

Imagine if I have a persistent class which represents a large table, let's say having 20 fields, is it better if I map this table to a SINGLE persistent class or make use of EMBEDDABLE class, somehow I extract some closely related fields and represent those field in another class, which is embeddable, though I cannot think of possible reuse on that embeddable class?

Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simple answer, is it depends. Think about this, your objects should be OO, make your objects as OO as possible, don't even think about how the database is designed, if pre-designed. Then after you have a great OO model, then map your classes to the tables, and you will find sometimes you need Embedded and sometimes not.

Mark
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can't reuse the embeddable class then its a toss up to me. I would probably do the first pass without the embeddable classes. and if the designed bugged me, i'd change it later. But if it was more work, i would not do it up front. Not worth it.
 
saranga rao
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

DB4 Object is working fine with open source and ORM tool
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic