Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Object Relational Mapping and the fly likes Convert to hibernate simple SQL statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Convert to hibernate simple SQL statement" Watch "Convert to hibernate simple SQL statement" New topic
Author

Convert to hibernate simple SQL statement

Alex Krasnikov
Greenhorn

Joined: Apr 06, 2011
Posts: 1
Hi everyone
Could you please help to convert tis sql statement to hibernate:
select * from table1 t1, table2 t2
where t1.id = t2.id;

thanks in advance
sorry for mistakes its my first topic here
Anantha Sharma
Ranch Hand

Joined: Sep 01, 2010
Posts: 43

HQL: from Table1 t1, Table2 t2 where t1.id=t2.id

This can get much simpler if you could share the mapping files you used for these 2 tables..

remember, in HQL you cannot use the table name, you can only use the POJO name (which is mapped)
 
 
subject: Convert to hibernate simple SQL statement