Wednesday, 20 April 2016

How to write join query in hibernate ?


Example
table Supplier ( id int, name VARCHAR)
table Product ( id int, name VARCHAR, description VARCHAR, price double, supplierId int)

Inner join
String hql = "from Supplier s inner join fetch s.products as p";
Query query = session.createQuery(hql);
List results = query.list();

No comments:

Post a Comment

Note: only a member of this blog may post a comment.