Model of hql query firing at back end by hql engine?
- by Maddy.Shik
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.