Hibernate Criterial you Must Know

Criteria in Hibernate has been there for a while, this morning it my first time to play with it. Great gain today. List a few key points to remember for all fellows.

 

1. Key to dynamic search. (of course can not solve all problem).

 

2. table join - Criterial#createAlias("property", "alias", JointType). you can do inner join, left join, full join.

 

3. Projections - another good one you must know, here is one example

Criteria criteria = getSession().createCriteria(Invoice.class).setProj ection(Projections.max("InvoiceDate"));

 

 

你可能感兴趣的:(Hibernate)