Model of hql query firing at back end by hql engine?
Posted
by
Maddy.Shik
on Stack Overflow
See other posts from Stack Overflow
or by Maddy.Shik
Published on 2010-12-26T22:48:03Z
Indexed on
2010/12/26
22:53 UTC
Read the original article
Hit count: 220
I want to understand how hibernate execute hql query internally or in other models how hql query engine works. Please suggest some good links for same?
One of reason for reading is following problem.
Class Branch
{
//lazy loaded
@joincolumn(name="company_id")
Company company;
}
Since company is heavy object so it is lazy loaded.
now i have hql query
"from Branch as branch where branch.Company.id=:companyId"
my concern is that if for firing above query, hql engine has to retrieve company object then its a performance hit and i would prefer to add one more property in Branch class i.e. companyId. So in this case hql query would be
"from Branch as branch where branch.companyId=:companyId"
If hql engine first generate sql from hql followed by firing of sql query itself, then there should be no performance issue.
Please let me know if problem is not understandable.
© Stack Overflow or respective owner