aspose file tools
The moose likes Object Relational Mapping and the fly likes Which is a better ORM design? (hibernate) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Which is a better ORM design? (hibernate)" Watch "Which is a better ORM design? (hibernate)" New topic
Author

Which is a better ORM design? (hibernate)

ayan sevi
Greenhorn

Joined: Sep 21, 2006
Posts: 21
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

Joined: Feb 05, 2001
Posts: 16622

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1158

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

Joined: Apr 24, 2007
Posts: 49
Hi,

DB4 Object is working fine with open source and ORM tool
 
 
subject: Which is a better ORM design? (hibernate)
 
Threads others viewed
JPA: how to model compound key which contains also a foreign key?
Collection mapping of Elements in JPA
(JPA) questions about embeddable class
Different Explainations abt Embeddable Classes
a very basic question on sql...
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture