hibernate Criteria

method
describe
Expression.eq
" field=value " expression corresponding to SQL
Such as: Expression.eq("name","zx");
Expression.allEq
The parameter of the method is a Map type object, which contains multiple name / value pair correspondences, which is equivalent to the superposition of multiple Expression.eq
Expression.gt
" field>value " expression corresponding to SQL
Expression.ge
" field>=value " expression corresponding to SQL
Expression.lt
Corresponds to the SQL " field " expression
Expression.the
" field<=value " expression corresponding to SQL
Expression.between
The between expression corresponding to the SQL statement , such as: querying users between the ages of 21 and 27 , can be written as Expression.between("age", new Integer(21), new Integer(27));
Expression.like
"field like value" expressions corresponding to SQL statements
Expression.in
" field in(...) " expression corresponding to SQL statement
Expression.eqProperty
Used to compare two attribute values, corresponding to the "field=field" SQL expression
Expression.gtProperty
Used to compare two attribute values, corresponding to the "field>field" SQL expression
Expression.geProperty
Used to compare two attribute values, corresponding to the "field>=field" SQL expression
Expression.ltProperty
Used to compare two attribute values, corresponding to the "field expression
Expression.leProperty
Used to compare two attribute values, corresponding to the "field<=field" SQL expression
Expression.and
Corresponding to the And relation combination of the SQL statement , such as: Expression.and(Expression.eq("name","zx"),Expression.eq("sex","1"));
Expression.or
Corresponding to the combination of Or relations of SQL statements , such as: Expression.or(Expression.eq("name","zx"),Expression.eq("name","zhaoxin"));
Expression.sql
As a supplement, this method provides native SQL statement query support, which is directly qualified by native SQL statements during execution, such as: Expression.sql("lower({alias}.name) like (?)","zhao%", Hibernate.STRING) ; at runtime { alias } will be replaced by the entity class name associated with the current query, ? in ( ) will be replaced by "zhao%" , and the type will be specified by Hibernate.STRING .

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326847791&siteId=291194637