Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Join(ORM)

 
Kalpesh K Rawal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i map 2 tables in a singel class?if not then how can achive it?
 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Naveen Mishra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!