views:

143

answers:

0

I want to use below code and want to get datas from both tables, but how? There aren't any association in my hibernate mapping files.

SQLQuery query = session.createSQLQuery("SELECT cat.* from cat inner join owner on cat.owner_id = owner.id where owner.name=:username");

query.addEntity(Cat.class);

query.setInteger("username",'Duke');

List =query.list();

Thanks in advance.