aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate Join(ORM) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Join(ORM)" Watch "Hibernate Join(ORM)" New topic
Author

Hibernate Join(ORM)

Kalpesh K Rawal
Greenhorn

Joined: Nov 23, 2005
Posts: 4
Can i map 2 tables in a singel class?if not then how can achive it?
Vikram Takkar
Greenhorn

Joined: Oct 27, 2005
Posts: 12
i dont think that you can map 2 tables in single class ... you can map one table in one class and you can have more than one class mapping in one file but its not the good programming practice.. you should implement class-per-file mechanism....

i m giving this reply up to my knowledge ..this may b correct or may not be..


Vikram Takkar<br />Programmer
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
U can certainly do it man !!!

just go through the following link...


http://www.gloegl.de/blog/archives/hibernate-hql-and-outer-join-fetching/
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

If you are using Hibernate3 then you can. Naveen Mishra's example doesn't map two tables to one class (though it does return data from two tables via HQL) - if you want the same behaviour via a mapping read the Hibernate documentation about the <join /> element.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate Join(ORM)