• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join two tables in hibernate

 
nidheesh ep
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I join two tables in hibernate. I have two tables User and Employee. My requirement is like,

SELECT userName,firstName FROM Employee AS emp LEFT JOIN User AS usr ON emp.userId=usr.userId. What I need to put in my pojo class. Employee is child class.
I have tried like, List<String> list = hibernateTemplate.find("from User usr left join usr.employee emp"); but it doesn't work. Since I am new to this, I need to know what else
I have to use in POJO class.
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi nidheesh

check jboss docs

Associations and joins in Hibernate

check thistutorial also which may be helpfull.


Regards
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try like this "from Car c join c.ownder".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic