Magazine
 
Hibernate Query Language

Criterion types.

In code this would be:Criterion crit=Restriction.eq(lngInsuranceId,5); criteria.add(crit);

Following important methods of the Expression class are shown in the table:

Method Description
Restriction.allEq This is used to apply an “equals”
constraint to each property in the key
set of a Map
Restriction.between This is used to apply a “between”
constraint to the named property
Restriction.eq This is used to apply an “equal”
constraint to the named property
Restriction.ge This is used to apply a “greater
than or equal” constraint to the
named property
Restriction.gt This is used to apply a “greater
than” constraint to the named property
Restriction.idEq This is used to apply an “equal”
constraint to the identifier property
Restriction.ilike This is caseinsensitive “like”,
similar to Postgres ilike operator
Restriction.in This is used to apply an “in” constraint to the named property

 
Restriction.isNotNull This is used to apply an “is not null”
constraint to the named property
Restriction.isNull This is used to apply an “is null” constraint to the named property
Restriction.le This is used to apply a “less than or equal” constraint to the named property
Restriction.like This is used to apply a “like” constraint to the named property
Restriction.lt This is used to apply a “less than”
constraint to the named property
Restriction.ltProperty This is used to apply a “less than”
constraint to two properties
Restriction.ne This is used to apply a “not equal”
constraint to the named property
Restriction.neProperty This is used to apply a “not equal”
constraint to two properties
Restriction.not This returns the negation of an
expression
Restriction.or This returns the disjuction of two
expressions

The Hibernate criteria query API provides two query types that allow programmatic fetching of persistent objects: query by criteria (QBC)

Mar 2008 | Java Jazz Up | 47
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59,

Download PDF