|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.avaje.ebean.Expr
public class Expr
Expression factory for creating standard expressions for WHERE and HAVING clauses.
Generally you will only need to use this object for creating OR, JUNCTION or
CONJUNCTION expressions. To create simple expressions you will most likely
just use the methods on the ExpressionList object that is returned via
Query.where()
.
This provides a convenient way to create expressions for the 'Default' server. It is actually a short cut for using the ExpressionFactory of the 'default' EbeanServer.
See also Ebean.getExpressionFactory()
Creates standard common expressions for using in a Query Where or Having clause.
// Example: Using an Expr.or() method Query<Order> query = Ebean.createQuery(Order.class); query.where( Expr.or(Expr.eq("status", Order.NEW), Expr.gt("orderDate", lastWeek)); List<Order> list = query.findList(); ...
Query.where()
Method Summary | |
---|---|
static Expression |
allEq(Map<String,Object> propertyMap)
All Equal - Map containing property names and their values. |
static Expression |
and(Expression expOne,
Expression expTwo)
And - join two expressions with a logical and. |
static Expression |
between(String propertyName,
Object value1,
Object value2)
Between - property between the two given values. |
static Junction |
conjunction()
Return a list of expressions that will be joined by AND's. |
static Expression |
contains(String propertyName,
String value)
Contains - property like %value%. |
static Junction |
disjunction()
Return a list of expressions that will be joined by OR's. |
static Expression |
endsWith(String propertyName,
String value)
Ends With - property like %value. |
static Expression |
eq(String propertyName,
Object value)
Equal To - property equal to the given value. |
static ExampleExpression |
exampleLike(Object example)
Create the query by Example expression which is case sensitive and using LikeType.RAW (you need to add you own wildcards % and _). |
static ExampleExpression |
exampleLike(Object example,
boolean caseInsensitive,
LikeType likeType)
Create the query by Example expression specifying more options. |
static Expression |
ge(String propertyName,
Object value)
Greater Than or Equal to - property greater than or equal to the given value. |
static Expression |
gt(String propertyName,
Object value)
Greater Than - property greater than the given value. |
static Expression |
icontains(String propertyName,
String value)
Case insensitive Contains - property like %value%. |
static Expression |
idEq(Object value)
Id Equal to - ID property is equal to the value. |
static Expression |
iendsWith(String propertyName,
String value)
Case insensitive Ends With - property like %value. |
static Expression |
ieq(String propertyName,
String value)
Case Insensitive Equal To - property equal to the given value (typically using a lower() function to make it case insensitive). |
static ExampleExpression |
iexampleLike(Object example)
Case insensitive exampleLike(Object) |
static Expression |
ilike(String propertyName,
String value)
Case insensitive Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore). |
static Expression |
in(String propertyName,
Collection<?> values)
In - property has a value in the collection of values. |
static Expression |
in(String propertyName,
Object[] values)
In - property has a value in the array of values. |
static Expression |
in(String propertyName,
Query<?> subQuery)
In - using a subQuery. |
static Expression |
isNotNull(String propertyName)
Is Not Null - property is not null. |
static Expression |
isNull(String propertyName)
Is Null - property is null. |
static Expression |
istartsWith(String propertyName,
String value)
Case insensitive Starts With - property like value%. |
static Expression |
le(String propertyName,
Object value)
Less Than or Equal to - property less than or equal to the given value. |
static Expression |
like(String propertyName,
String value)
Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore). |
static Expression |
lt(String propertyName,
Object value)
Less Than - property less than the given value. |
static Expression |
ne(String propertyName,
Object value)
Not Equal To - property not equal to the given value. |
static Expression |
not(Expression exp)
Negate the expression (prefix it with NOT). |
static Expression |
or(Expression expOne,
Expression expTwo)
Or - join two expressions with a logical or. |
static Expression |
raw(String raw)
Add raw expression with no parameters. |
static Expression |
raw(String raw,
Object value)
Add raw expression with a single parameter. |
static Expression |
raw(String raw,
Object[] values)
Add raw expression with an array of parameters. |
static Expression |
startsWith(String propertyName,
String value)
Starts With - property like value%. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Expression eq(String propertyName, Object value)
public static Expression ne(String propertyName, Object value)
public static Expression ieq(String propertyName, String value)
public static Expression between(String propertyName, Object value1, Object value2)
public static Expression gt(String propertyName, Object value)
public static Expression ge(String propertyName, Object value)
public static Expression lt(String propertyName, Object value)
public static Expression le(String propertyName, Object value)
public static Expression isNull(String propertyName)
public static Expression isNotNull(String propertyName)
public static ExampleExpression iexampleLike(Object example)
exampleLike(Object)
public static ExampleExpression exampleLike(Object example)
public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType)
public static Expression like(String propertyName, String value)
public static Expression ilike(String propertyName, String value)
public static Expression startsWith(String propertyName, String value)
public static Expression istartsWith(String propertyName, String value)
public static Expression endsWith(String propertyName, String value)
public static Expression iendsWith(String propertyName, String value)
public static Expression contains(String propertyName, String value)
public static Expression icontains(String propertyName, String value)
public static Expression in(String propertyName, Object[] values)
public static Expression in(String propertyName, Query<?> subQuery)
public static Expression in(String propertyName, Collection<?> values)
public static Expression idEq(Object value)
public static Expression allEq(Map<String,Object> propertyMap)
Expression where all the property names in the map are equal to the corresponding value.
propertyMap
- a map keyed by property names.public static Expression raw(String raw, Object value)
The raw expression should contain a single ? at the location of the parameter.
public static Expression raw(String raw, Object[] values)
The raw expression should contain the same number of ? as there are parameters.
public static Expression raw(String raw)
public static Expression and(Expression expOne, Expression expTwo)
public static Expression or(Expression expOne, Expression expTwo)
public static Expression not(Expression exp)
public static Junction conjunction()
public static Junction disjunction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |