This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Join(ORM)