HHH-6766 - Documentation

This commit is contained in:
Lukasz Antoniak 2011-10-25 18:37:21 +02:00 committed by Strong Liu
parent c74610bd80
commit cbbc786f18
1 changed files with 12 additions and 0 deletions

View File

@ -485,6 +485,18 @@ session.createCriteria(Cat.class)
.add( Property.forName("cat2.sex").eqProperty("cat.sex") );
session.createCriteria(Cat.class, "cat")
.add( Property.forName("weight").gt(avgWeightForSex) )
.list();]]></programlisting>
<para>
Example of multi-column restriction based on a subquery:
</para>
<programlisting role="JAVA"><![CDATA[DetachedCriteria sizeQuery = DetachedCriteria.forClass( Man.class )
.setProjection( Projections.projectionList().add( Projections.property( "weight" ) )
.add( Projections.property( "height" ) ) )
.add( Restrictions.eq( "name", "John" ) );
session.createCriteria( Woman.class )
.add( Subqueries.propertiesEq( new String[] { "weight", "height" }, sizeQuery ) )
.list();]]></programlisting>
</section>