Skip to content

Instantly share code, notes, and snippets.

@rvazquezglez
Created December 8, 2012 10:53
Show Gist options
  • Save rvazquezglez/4239784 to your computer and use it in GitHub Desktop.
Save rvazquezglez/4239784 to your computer and use it in GitHub Desktop.
Ejemplo de uso de criteria de hibernate.
List cats = sess.createCriteria(Cat.class)
.add( Restrictions.in( "name", new String[] { "Fritz", "Izi", "Pk" } ) )
.add( Restrictions.disjunction()
.add( Restrictions.isNull("age") )
.add( Restrictions.eq("age", new Integer(0) ) )
.add( Restrictions.eq("age", new Integer(1) ) )
.add( Restrictions.eq("age", new Integer(2) ) )
) )
.list();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment