|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.expressions.Expression
public abstract class Expression
Purpose: Define an object-level representation of a database query where clause.
Description: An expression is a tree-like structure that defines the selection criteria for a query against objects in the database. The expression has the advantage over SQL by being at the object-level, i.e. the object model attributes and relationships can be used to be query on instead of the database field names. Because it is an object, not a string the expression has the advantage that is can be easily manipulated through code to easily build complex selection criterias.
Responsibilities:
Field Summary | |
---|---|
protected org.eclipse.persistence.internal.helper.DatabaseTable |
currentAlias
|
protected int |
hashCode
PERF: Cache the hashCode. |
protected org.eclipse.persistence.internal.helper.DatabaseTable |
lastTable
Temporary values for table aliasing |
protected boolean |
selectIfOrderedBy
|
Constructor Summary | |
---|---|
Expression()
Base Expression Constructor. |
Method Summary | |
---|---|
Expression |
addDate(java.lang.String datePart,
int numberToAdd)
PUBLIC: Function, return an expression that adds to a date based on the specified datePart. |
Expression |
addDate(java.lang.String datePart,
java.lang.Object numberToAdd)
PUBLIC: Function, return an expression that adds to a date based on the specified datePart. |
Expression |
addMonths(int months)
PUBLIC: Function, to add months to a date. |
Expression |
addMonths(java.lang.Object months)
PUBLIC: Function, to add months to a date. |
org.eclipse.persistence.internal.helper.DatabaseTable |
aliasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL: Find the alias for a given table |
Expression |
all(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. |
Expression |
all(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(Expression arguments)
|
Expression |
all(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(ReportQuery subQuery)
|
Expression |
all(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
all(java.util.Vector theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
allOf(java.lang.String attributeName,
Expression criteria)
PUBLIC: Returns an expression equivalent to all of attributeName
holding true for criteria . |
Expression |
and(Expression theExpression)
PUBLIC: Return an expression that is the boolean logical combination of both expressions. |
Expression |
any(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. |
Expression |
any(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(Expression arguments)
|
Expression |
any(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(ReportQuery subQuery)
|
Expression |
any(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
any(java.util.Vector theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
anyOf(java.lang.String attributeName)
PUBLIC: Return an expression representing traversal of a 1:many or many:many relationship. |
Expression |
anyOfAllowingNone(java.lang.String attributeName)
ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship. |
Expression |
as(java.lang.Class castClass)
ADVANCED: Return an expression that allows you to treat its base as if it were a subclass of the class returned by the base This can only be called on an ExpressionBuilder, the result of expression.get(String), expression.getAllowingNull(String), the result of expression.anyOf("String") or the result of expression.anyOfAllowingNull("String") as does not guarantee the results of the downcast will be of the specified class and should be used in conjunction with a Expression.type() Example: EclipseLink: employee.get("project").as(LargeProject.class).get("budget").equal(1000) Java: ((LargeProject)employee.getProjects().get(0)).getBudget() == 1000 SQL: LPROJ.PROJ_ID (+)= PROJ.PROJ_ID AND L_PROJ.BUDGET = 1000 |
Expression |
ascending()
PUBLIC: This can only be used within an ordering expression. |
Expression |
asciiValue()
PUBLIC: Function, returns the single character strings ascii value. |
Expression |
asOf(AsOfClause pastTime)
Sets all tables represented by this expression to be queried as of a past time. |
protected void |
assignAlias(java.lang.String name,
org.eclipse.persistence.internal.helper.DatabaseTable tableOrExpression)
INTERNAL: Alias a particular table within this node |
int |
assignTableAliasesStartingAt(int initialValue)
INTERNAL: Assign aliases to any tables which I own. |
Expression |
average()
PUBLIC: Function, This represents the aggregate function Average. |
Expression |
between(byte leftValue,
byte rightValue)
PUBLIC: Function, between two bytes |
Expression |
between(char leftChar,
char rightChar)
PUBLIC: Function, between two chars |
Expression |
between(double leftValue,
double rightValue)
PUBLIC: Function, between two doubles |
Expression |
between(Expression leftExpression,
Expression rightExpression)
|
Expression |
between(float leftValue,
float rightValue)
PUBLIC: Function, between two floats |
Expression |
between(int leftValue,
int rightValue)
PUBLIC: Function, between two ints |
Expression |
between(long leftValue,
long rightValue)
PUBLIC: Function, between two longs |
Expression |
between(java.lang.Object leftValue,
java.lang.Object rightValue)
PUBLIC: Return an expression that compares if the receiver's value is between two other values. |
Expression |
between(short leftValue,
short rightValue)
PUBLIC: Function, between two shorts |
org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression |
caseConditionStatement()
INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form: SQL: CASE WHEN name = "Robert" THEN "Bob" WHEN name = "Susan" THEN "Sue" ELSE "No-Nickname" This expression must be manipulated to successfully build a case statement by adding appropriate children to it. |
Expression |
caseConditionStatement(java.util.Map<Expression,java.lang.Object> caseConditions,
java.lang.Object defaultItem)
PUBLIC: Function Convert values returned by the query to values given in the caseConditions Map. |
org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression |
caseStatement()
INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form: SQL: CASE name WHEN "Robert" THEN "Bob" WHEN "Susan" THEN "Sue" ELSE "No-Nickname" This expression must be manipulated to successfully build a case statement by adding appropriate children to it. |
Expression |
caseStatement(java.util.Map caseItems,
java.lang.Object defaultItem)
PUBLIC: Function Convert values returned by the query to values given in the caseItems Map. |
java.lang.Object |
clone()
INTERNAL: Clone the expression maintaining clone identity in the inter-connected expression graph. |
Expression |
cloneUsing(Expression newBase)
INTERNAL: This expression is built on a different base than the one we want. |
org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression |
coalesce()
|
org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression |
coalesce(java.util.Collection expressions)
PUBLIC: Function Return null if all arguments are null and the first non-null argument otherwise The equivalent of the COALESCE SQL function Example: Vector list = new Vector(3); list.add(builder.get("firstName")); list.add(builder.get("lastName")); list.add(builder.get("nickname")); EclipseLink: expressionBuilder.coalesce(caseTable) Java: NA SQL: COALESCE(firstname, lastname, nickname) |
int |
computeHashCode()
INTERNAL: Compute a consistent hash-code for the expression. |
Expression |
concat(java.lang.Object left)
PUBLIC: Function, returns the concatenation of the two string values. |
Expression |
containsAllKeyWords(java.lang.String spaceSeparatedKeyWords)
PUBLIC: Return an expression that performs a key word search. |
Expression |
containsAnyKeyWords(java.lang.String spaceSeparatedKeyWords)
PUBLIC: Return an expression that performs a key word search. |
Expression |
containsSubstring(Expression expression)
PUBLIC: Return an expression that compares if the receivers value contains the substring. |
Expression |
containsSubstring(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value contains the substring. |
Expression |
containsSubstringIgnoringCase(Expression expression)
PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case. |
Expression |
containsSubstringIgnoringCase(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case. |
protected void |
convertNodeToUseOuterJoin()
|
Expression |
convertToUseOuterJoin()
INTERNAL: Modify this expression to use outer joins wherever there are equality operations between two field nodes. |
Expression |
copiedVersionFrom(java.util.Map alreadyDone)
INTERNAL: |
Expression |
count()
PUBLIC: This represents the aggregate function Average. |
Expression |
create(Expression base,
java.lang.Object singleArgument,
ExpressionOperator anOperator)
INTERNAL: |
Expression |
create(Expression base,
java.util.Vector arguments,
ExpressionOperator anOperator)
INTERNAL: |
Expression |
createWithBaseLast(Expression base,
java.lang.Object singleArgument,
ExpressionOperator anOperator)
INTERNAL: |
Expression |
currentDate()
PUBLIC: This gives access to the current date on the database through expression. |
Expression |
currentDateDate()
PUBLIC: This gives access to the current date only on the database through expression. |
Expression |
currentTime()
PUBLIC: This gives access to the current time only on the database through expression. |
Expression |
currentTimeStamp()
PUBLIC: This gives access to the current timestamp on the database through expression. |
Expression |
dateDifference(java.lang.String datePart,
java.util.Date date)
PUBLIC: Function, Return the difference between the queried part of a date(i.e. years, days etc.) |
Expression |
dateDifference(java.lang.String datePart,
Expression comparisonExpression)
PUBLIC: Function, Return the difference between the queried part of a date(i.e. years, days etc.) |
Expression |
dateName(java.lang.String datePart)
PUBLIC: return a string that represents the given part of a date. |
Expression |
datePart(java.lang.String datePart)
PUBLIC: Function return an integer which represents the requested part of the date. |
Expression |
dateToString()
PUBLIC: Function, returns the date converted to the string value in the default database format. |
Expression |
decode(java.util.Map decodeableItems,
java.lang.String defaultItem)
PUBLIC: Function Convert values returned by the query to values given in the decodeableItems Map. |
Expression |
descending()
PUBLIC: This can only be used within an ordering expression. |
java.lang.String |
descriptionOfNodeType()
INTERNAL: Used in debug printing of this node. |
boolean |
detectExpression(java.util.Vector theObjects)
INTERNAL: Check if any element in theObjects is Expression. |
Expression |
difference(java.lang.String expression)
PUBLIC: Function return a value which indicates how much difference there is between two expressions. |
Expression |
distinct()
PUBLIC: Function, This represents the distinct option inside an aggregate function. |
boolean |
doesConform(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
int valueHolderPolicy)
INTERNAL: Check if the object conforms to the expression in memory. |
boolean |
doesConform(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
int valueHolderPolicy,
boolean objectIsUnregistered)
INTERNAL: New parameter added to doesConform for feature 2612601 |
Expression |
equal(boolean theBoolean)
|
Expression |
equal(byte theValue)
|
Expression |
equal(char theChar)
|
Expression |
equal(double theValue)
|
Expression |
equal(Expression theValue)
Returns an expression that compares if the receiver's value is equal to the other value. |
Expression |
equal(float theValue)
|
Expression |
equal(int theValue)
|
Expression |
equal(long theValue)
|
Expression |
equal(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receiver's value is equal to the other value. |
Expression |
equal(short theValue)
|
Expression |
equalOuterJoin(Expression theValue)
INTERNAL: Return an expression representing an outer join comparison |
Expression |
equalOuterJoin(java.lang.Object theValue)
INTERNAL: Return an expression representing an outer join comparison |
boolean |
equals(java.lang.Object expression)
INTERNAL: Return if the expression is equal to the other. |
Expression |
equalsIgnoreCase(Expression theValue)
PUBLIC: Return an expression that compares if the receiver's value is equal to the other value, ignoring case. |
Expression |
equalsIgnoreCase(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receiver's value is equal to the other value, ignoring case. |
Expression |
exists(ReportQuery subQuery)
PUBLIC: Return a sub query expression. |
Expression |
existsNode(java.lang.String xpath)
PUBLIC: XMLType Function, gets the number of nodes returned by the given xpath expression returns 0 if there are none |
Expression |
extract(java.lang.String xpath)
PUBLIC: XMLType Function, extracts a secton of XML from a larget XML document |
boolean |
extractPrimaryKeyFields(boolean requireExactMatch,
ClassDescriptor descriptor,
java.util.Set<org.eclipse.persistence.internal.helper.DatabaseField> fields)
INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set. |
boolean |
extractPrimaryKeyValues(boolean requireExactMatch,
ClassDescriptor descriptor,
org.eclipse.persistence.internal.sessions.AbstractRecord primaryKeyRow,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
INTERNAL: Extract the primary key from the expression into the row. |
Expression |
extractValue(java.lang.String xpath)
PUBLIC: XMLType Function, extracts a value from an XMLType field |
static Expression |
from(java.lang.Object value,
Expression base)
INTERNAL: Create an expression node. |
static Expression |
fromConstant(java.lang.Object value,
Expression base)
INTERNAL: Create an expression node. |
static Expression |
fromLiteral(java.lang.String value,
Expression base)
INTERNAL: Create an expression node. |
Expression |
get(java.lang.String attributeName)
PUBLIC: Return an expression that wraps the attribute or query key name. |
Expression |
get(java.lang.String attributeName,
java.util.Vector arguments)
INTERNAL: |
Expression |
getAllowingNull(java.lang.String attributeName)
ADVANCED: Return an expression that wraps the attribute or query key name. |
Expression |
getAllowingNull(java.lang.String attributeName,
java.util.Vector arguments)
INTERNAL: |
AsOfClause |
getAsOfClause()
Answers the past time the expression is explicitly as of. |
AsOfClause |
getAsOfClauseRecursively()
INTERNAL: For Flashback: If this expression is not already as of some timestamp gets the clause from the base expression. |
abstract ExpressionBuilder |
getBuilder()
INTERNAL: Return the expression builder which is the ultimate base of this expression, or null if there isn't one (shouldn't happen if we start from a root) |
org.eclipse.persistence.internal.helper.DatabaseField |
getClonedField()
INTERNAL: If there are any fields associated with this expression, return them |
Expression |
getField(org.eclipse.persistence.internal.helper.DatabaseField field)
ADVANCED: Return an expression representing a field in a data-level query. |
Expression |
getField(java.lang.String fieldName)
ADVANCED: Return an expression representing a field in a data-level query. |
java.util.Vector |
getFields()
INTERNAL: |
java.lang.Object |
getFieldValue(java.lang.Object objectValue,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Transform the object-level value into a database-level value |
Expression |
getFunction(int selector)
ADVANCED: This can be used for accessing user defined functions. |
Expression |
getFunction(int selector,
java.util.Vector arguments)
ADVANCED: This can be used for accessing user defined functions that have arguments. |
Expression |
getFunction(java.lang.String functionName)
ADVANCED: Return a user defined function accepting the argument. |
Expression |
getFunction(java.lang.String functionName,
java.lang.Object argument)
ADVANCED: Return a user defined function accepting the argument. |
Expression |
getFunctionWithArguments(java.lang.String functionName,
java.util.Vector arguments)
ADVANCED: Return a user defined function accepting all of the arguments. |
java.lang.String |
getName()
INTERNAL: |
Expression |
getNumberVal()
PUBLIC: XMLType Function - gets a number value from an XMLType |
ExpressionOperator |
getOperator()
INTERNAL: Most expression have operators, so this is just a convenience method. |
ExpressionOperator |
getOperator(int selector)
INTERNAL: Create a new expression tree with the named operator. |
java.util.Vector |
getOwnedTables()
INTERNAL: Return the tables that this node owns for purposes of table aliasing. |
Expression |
getParameter(org.eclipse.persistence.internal.helper.DatabaseField field)
ADVANCED: Return an expression representing a parameter with the given name. |
Expression |
getParameter(java.lang.String parameterName)
ADVANCED: Return an expression representing a parameter with the given name. |
Expression |
getParameter(java.lang.String parameterName,
java.lang.Object type)
INTERNAL: Return an expression representing a parameter with the given name and type |
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession()
INTERNAL: |
Expression |
getStringVal()
PUBLIC: XMLType Function - gets a string value from an XMLType |
Expression |
getTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
ADVANCED: Return an expression representing a table in a data-level query. |
Expression |
getTable(java.lang.String tableName)
ADVANCED: Return an expression representing a table in a data-level query. |
org.eclipse.persistence.internal.expressions.TableAliasLookup |
getTableAliases()
INTERNAL: Return the aliases used. |
Expression |
greaterThan(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(char theChar)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(double theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(Expression theValue)
|
Expression |
greaterThan(float theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(int theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(long theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThan(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receiver's value is greater than the other value. |
Expression |
greaterThan(short theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. |
Expression |
greaterThanEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
Expression |
greaterThanEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. |
boolean |
hasAsOfClause()
ADVANCED: Answers true if this is to be queried as of a past time. |
boolean |
hasBeenAliased()
INTERNAL: Answers if the database tables associated with this expression have been aliased. |
int |
hashCode()
INTERNAL: Return a consistent hash-code for the expression. |
Expression |
hexToRaw()
PUBLIC: Function, returns binary array value for the hex string. |
Expression |
ifNull(java.lang.Object nullValue)
PUBLIC: Function return a specific value if item returned from the query is null. |
Expression |
in(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(byte[] theBytes)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(java.util.Collection theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(Expression arguments)
|
Expression |
in(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
in(ReportQuery subQuery)
|
Expression |
in(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
index()
|
Expression |
indexOf(java.lang.Object substring)
PUBLIC: Function, returns the integer index of the substring within the source string. |
boolean |
isClassTypeExpression()
INTERNAL: |
boolean |
isCompoundExpression()
INTERNAL: |
boolean |
isConstantExpression()
INTERNAL: |
boolean |
isDataExpression()
INTERNAL: |
Expression |
isEmpty(java.lang.String attributeName)
PUBLIC: A logical expression for the collection attributeName
being empty. |
boolean |
isExpressionBuilder()
INTERNAL: |
boolean |
isFieldExpression()
INTERNAL: |
Expression |
isFragment()
PUBLIC: XMLType Function - evaluates to 0 if the xml is a well formed document and 1 if the document is a fragment |
boolean |
isFunctionExpression()
INTERNAL: |
boolean |
isLiteralExpression()
INTERNAL: |
boolean |
isLogicalExpression()
INTERNAL: |
boolean |
isMapEntryExpression()
INTERNAL: |
Expression |
isNull()
PUBLIC: Compare to null. |
boolean |
isObjectExpression()
INTERNAL: |
boolean |
isParameterExpression()
INTERNAL: |
boolean |
isQueryKeyExpression()
INTERNAL: |
boolean |
isRelationExpression()
INTERNAL: |
boolean |
isTableExpression()
INTERNAL: |
boolean |
isValueExpression()
INTERNAL: Subclasses implement (isParameterExpression() || isConstantExpression()) |
void |
iterateOn(org.eclipse.persistence.internal.expressions.ExpressionIterator iterator)
INTERNAL: For iterating using an inner class |
Expression |
lastDay()
PUBLIC: Function, returns the date with the last date in the months of this source date. |
Expression |
leftPad(int size,
java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size. |
Expression |
leftPad(java.lang.Object size,
java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size. |
Expression |
leftTrim()
PUBLIC: Function, returns the string left trimmed for white space. |
Expression |
leftTrim(java.lang.Object substring)
PUBLIC: Function, returns the string with the substring trimed from the left. |
Expression |
length()
PUBLIC: Function, returns the size of the string. |
Expression |
lessThan(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(char theChar)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(double theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(Expression theValue)
|
Expression |
lessThan(float theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(int theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(long theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThan(short theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. |
Expression |
lessThanEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
lessThanEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. |
Expression |
like(Expression argument)
PUBLIC: Return an expression that compares if the receivers value is like other value. |
Expression |
like(Expression value,
Expression escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is like other value. |
Expression |
like(java.lang.String value)
PUBLIC: Return an expression that compares if the receivers value is like other value. |
Expression |
like(java.lang.String value,
java.lang.String escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is like other value. |
Expression |
likeIgnoreCase(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case. |
Expression |
likeIgnoreCase(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case. |
Expression |
literal(java.lang.String literal)
ADVANCED: Return an expression on the literal. |
Expression |
locate(java.lang.Object str)
PUBLIC: Function, returns the position of str in this
Example:
EclipseLink: employee.get("firstName").locate("ob")
Java: employee.getFirstName().indexOf("ob") + 1
SQL: LOCATE('ob', t0.F_NAME)
Note that while in String.locate(str) -1 is returned if not found, and the
index starting at 0 if found, in SQL it is 0 if not found, and the index
starting at 1 if found. |
Expression |
locate(java.lang.Object str,
java.lang.Object fromIndex)
PUBLIC: Function, returns the position of str in this ,
starting the search at fromIndex . |
Expression |
locate(java.lang.String str,
int fromIndex)
PUBLIC: Function, returns the position of str in this ,
starting the search at fromIndex . |
Expression |
mapEntry()
PUBLIC: Return a Map.Entry containing the key and the value from a mapping that maps to a java.util.Map This expression can only be used as a return value in a ReportQuery and cannot be used as part of the WHERE clause in any query EclipseLink: eb.get("mapAttribute").mapEntry() |
Expression |
mapKey()
PUBLIC: Return the key from a mapping that maps to a java.util.Map This expression can be used either in as a return value in a ReportQuery or in the WHERE clause in a query EclipseLink: eb.get("mapAttribute").mapKey() |
Expression |
maximum()
PUBLIC: This represents the aggregate function Maximum. |
Expression |
minimum()
PUBLIC: This represents the aggregate function Minimum. |
Expression |
monthsBetween(java.lang.Object otherDate)
PUBLIC: Function, returns the decimal number of months between the two dates. |
Expression |
newTime(java.lang.String timeZoneFrom,
java.lang.String timeZoneTo)
PUBLIC: funcation return a date converted to a new timezone. |
Expression |
nextDay(java.lang.Object dayName)
PUBLIC: Function, returns the date with the next day from the source date as the day name given. |
Expression |
noneOf(java.lang.String attributeName,
Expression criteria)
PUBLIC: Returns an expression equivalent to none of attributeName
holding true for criteria . |
Expression |
normalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)
INTERNAL: Normalize into a structure that is printable. |
Expression |
not()
PUBLIC: Return an expression that is the boolean logical negation of the expression. |
Expression |
notBetween(byte leftValue,
byte rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(char leftChar,
char rightChar)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(double leftValue,
double rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(Expression leftExpression,
Expression rightExpression)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(float leftValue,
float rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(int leftValue,
int rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(long leftValue,
long rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(java.lang.Object leftValue,
java.lang.Object rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notBetween(short leftValue,
short rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. |
Expression |
notEmpty(java.lang.String attributeName)
PUBLIC: A logical expression for the collection attributeName
not being empty. |
Expression |
notEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. |
Expression |
notExists(ReportQuery subQuery)
PUBLIC: Return a sub query expression. |
Expression |
notIn(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(byte[] theBytes)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(java.util.Collection theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(Expression arguments)
|
Expression |
notIn(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notIn(ReportQuery subQuery)
|
Expression |
notIn(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
notLike(Expression arguments)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. |
Expression |
notLike(Expression value,
Expression escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. |
Expression |
notLike(java.lang.String aString)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. |
Expression |
notLike(java.lang.String value,
java.lang.String escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. |
Expression |
notNull()
PUBLIC: Return an expression representing a comparison to null Example: EclipseLink: employee.get("age").notNull() Java: employee.getAge() ! |
Expression |
nullIf(java.lang.Object object)
PUBLIC: Function Test if arguments are equal, returning null if they are and the value of the first expression otherwise. |
Expression |
or(Expression theExpression)
PUBLIC: Return an expression that is the boolean logical combination of both expressions. |
Expression |
performOperator(ExpressionOperator anOperator,
java.util.Vector args)
INTERNAL: |
protected void |
postCopyIn(java.util.Map alreadyDone)
|
Expression |
postfixSQL(java.lang.String sqlString)
ADVANCED: Inserts the SQL as is directly into the expression. |
Expression |
prefixSQL(java.lang.String sqlString)
ADVANCED: Insert the SQL as is directly into the expression. |
void |
printJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)
INTERNAL: Print java for project class generation |
abstract void |
printSQL(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer)
INTERNAL: Print SQL |
abstract Expression |
rebuildOn(Expression newBase)
INTERNAL: This expression is built on a different base than the one we want. |
Expression |
ref()
ADVANCED: For Object-relational support. |
protected Expression |
registerIn(java.util.Map alreadyDone)
|
Expression |
replace(java.lang.Object stringToReplace,
java.lang.Object stringToReplaceWith)
PUBLIC: Function, returns the string with occurances of the first substring replaced with the second substring. |
Expression |
replicate(int constant)
PUBLIC: return the result of this query repeated a given number of times. |
Expression |
replicate(java.lang.Object theValue)
PUBLIC: return the result of this query repeated a given number of times. |
protected void |
resetCache()
Reset cached information here so that we can be sure we're accurate. |
abstract void |
resetPlaceHolderBuilder(ExpressionBuilder queryBuilder)
INTERNAL: Search the tree for any expressions (like SubSelectExpressions) that have been built using a builder that is not attached to the query. |
Expression |
reverse()
PUBLIC: Function return the reverse of the query result. |
Expression |
right(int characters)
PUBLIC: Function return a given number of characters starting at the right of a string. |
Expression |
right(java.lang.Object characters)
PUBLIC: Function return a given number of characters starting at the right of a string. |
Expression |
rightPad(int size,
java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size. |
Expression |
rightPad(java.lang.Object size,
java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size. |
Expression |
rightTrim()
PUBLIC: Function, returns the string right trimmed for white space. |
Expression |
rightTrim(java.lang.Object substring)
PUBLIC: Function, returns the string with the substring trimed from the right. |
Expression |
roundDate(java.lang.Object yearOrMonthOrDayRoundToken)
PUBLIC: Function, returns the date rounded to the year, month or day. |
boolean |
selectIfOrderedBy()
PUBLIC: Return whether this expression should be included in the SELECT clause if it is used in an ORDER BY clause |
void |
setLocalBase(Expression exp)
INTERNAL: Set the local base expression, ie the one on the other side of the operator Most types will ignore this, since they don't need it. |
void |
setSelectIfOrderedBy(boolean selectIfOrderedBy)
PUBLIC: Set whether this expression should be included in the SELECT clause of a query that uses it in the ORDER BY clause. |
Expression |
shallowClone()
INTERNAL: |
Expression |
size(java.lang.Class returnType)
PUBLIC: A logical expression for the size of collection expression. |
Expression |
size(java.lang.String attributeName)
PUBLIC: A logical expression for the size of collection attributeName . |
Expression |
some(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. |
Expression |
some(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(Expression arguments)
|
Expression |
some(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(ReportQuery subQuery)
|
Expression |
some(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
some(java.util.Vector theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. |
Expression |
standardDeviation()
PUBLIC: This represents the aggregate function StandardDeviation. |
Expression |
subQuery(ReportQuery subQuery)
PUBLIC: Return a sub query expression. |
Expression |
substring(int startPosition)
PUBLIC: Function, returns the substring from the source string. |
Expression |
substring(int startPosition,
int size)
PUBLIC: Function, returns the substring from the source string. |
Expression |
substring(java.lang.Object startPosition)
PUBLIC: Function, returns the substring from the source string. |
Expression |
substring(java.lang.Object startPosition,
java.lang.Object size)
PUBLIC: Function, returns the substring from the source string. |
Expression |
sum()
PUBLIC: This represents the aggregate function Sum. |
Expression |
toChar()
PUBLIC: Return an expression that represents the receiver value converted to a character string. |
Expression |
toChar(java.lang.String format)
PUBLIC: Return an expression that represents the receiver value converted to a character string, with the database formating options (i.e. |
Expression |
toCharacter()
PUBLIC: Function, returns the single character string with the ascii or character set value. |
Expression |
toDate()
PUBLIC: Function, returns date from the string using the default format. |
Expression |
toLowerCase()
PUBLIC: Return an expression that represents the receiver value converted to lower case. |
Expression |
toNumber()
PUBLIC: Function, returns the number converted from the string. |
java.lang.String |
toString()
PUBLIC: Print a debug form of the expression tree. |
void |
toString(java.io.BufferedWriter writer,
int indent)
INTERNAL: Print a debug form of the expression tree. |
Expression |
toUpperCase()
PUBLIC: Return an expression that represents the receiver value converted to upper case. |
Expression |
toUppercaseCasedWords()
PUBLIC: Function, returns the string with the first letter of each word capitalized. |
Expression |
translate(java.lang.Object fromString,
java.lang.Object toString)
PUBLIC: Function, returns the string with each char from the from string converted to the char in the to string. |
Expression |
trim()
PUBLIC: Function, returns the string trimmed for white space. |
Expression |
trim(java.lang.Object substring)
PUBLIC: Function, returns the string right and left trimmed for the substring. |
Expression |
truncateDate(java.lang.String datePart)
PUBLIC: return the date truncated to the indicated datePart. |
Expression |
twist(Expression expression,
Expression newBase)
INTERNAL: We are given an expression that comes from a different context than the one in which this was built, e.g. it is the selection criteria of a mapping, or the criteria on which multiple tables are joined in a descriptor. |
Expression |
twistedForBaseAndContext(Expression newBase,
Expression context)
INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression. |
Expression |
type()
PUBLIC: Return an expression that wraps the inheritance type field in an expression. |
void |
validateNode()
INTERNAL: Do any required validation for this node. |
Expression |
value()
PUBLIC: Function, this represents the value function, used in nestedtable |
Expression |
value(boolean constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(byte constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(char constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(double constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(float constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(int constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(long constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(java.lang.Object constant)
PUBLIC: Return an expression on the constant. |
Expression |
value(short constant)
PUBLIC: Return an expression on the constant. |
java.lang.Object |
valueFromObject(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
int valueHolderPolicy)
INTERNAL: Return the value for in memory comparison. |
java.lang.Object |
valueFromObject(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
int valueHolderPolicy,
boolean isObjectUnregistered)
INTERNAL: Return the value for in memory comparison. |
Expression |
variance()
PUBLIC: Function, this represents the aggregate function Variance. |
protected void |
writeAlias(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer,
org.eclipse.persistence.internal.helper.DatabaseField field,
org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
INTERNAL: Append the field's alias to the writer. |
void |
writeDescriptionOn(java.io.BufferedWriter writer)
INTERNAL: Used to print a debug form of the expression tree. |
protected void |
writeField(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer,
org.eclipse.persistence.internal.helper.DatabaseField field,
org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
INTERNAL: Append the field name to the writer. |
void |
writeFields(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer,
java.util.Vector newFields,
org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
INTERNAL: called from SQLSelectStatement.writeFieldsFromExpression(...) |
void |
writeSubexpressionsTo(java.io.BufferedWriter writer,
int indent)
INTERNAL: Used in SQL printing. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient org.eclipse.persistence.internal.helper.DatabaseTable lastTable
protected transient org.eclipse.persistence.internal.helper.DatabaseTable currentAlias
protected boolean selectIfOrderedBy
protected int hashCode
Constructor Detail |
---|
public Expression()
Method Detail |
---|
public Expression addDate(java.lang.String datePart, int numberToAdd)
Example:
EclipseLink: employee.get("date").addDate("year", 2) Java: NA SQL: DATEADD(date, 2, year)
public Expression addDate(java.lang.String datePart, java.lang.Object numberToAdd)
Example:
EclipseLink: employee.get("date").addDate("year", 2) Java: NA SQL: DATEADD(date, 2, year)
public Expression addMonths(int months)
public Expression addMonths(java.lang.Object months)
public org.eclipse.persistence.internal.helper.DatabaseTable aliasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
public Expression allOf(java.lang.String attributeName, Expression criteria)
attributeName
holding true for criteria
.
For every expression with an anyOf, its negation has either an allOf or a noneOf. The following two examples will illustrate as the second is the negation of the first:
AnyOf Example: Employees with a non '613' area code phone number.
ReadAllQuery query = new ReadAllQuery(Employee.class); ExpressionBuilder employee = new ExpressionBuilder(); Expression exp = employee.anyOf("phoneNumbers").get("areaCode").notEqual("613");
AllOf Example: Employees with all '613' area code phone numbers.
ExpressionBuilder employee = new ExpressionBuilder(); ExpressionBuilder phones = new ExpressionBuilder(); Expression exp = employee.allOf("phoneNumbers", phones.get("areaCode").equal("613")); SQL: SELECT ... EMPLOYEE t0 WHERE NOT EXISTS (SELECT ... PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID) AND NOT (t1.AREACODE = '613'))
allOf is the universal counterpart to the existential anyOf. To have the condition evaluated for each instance it must be put inside of a subquery, which can be expressed as not exists (any of attributeName some condition). (All x such that y = !Exist x such that !y).
Likewise the syntax employee.allOf("phoneNumbers").get("areaCode").equal("613") is not supported for the
equalmust go inside a subQuery.
This method saves you from writing the sub query yourself. The above is equivalent to the following expression:
ExpressionBuilder employee = new ExpressionBuilder(); ExpressionBuilder phone = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Phone.class, phone); subQuery.retreivePrimaryKeys(); subQuery.setSelectionCriteria(phone.equal(employee.anyOf("phoneNumbers").and( phone.get("areaCode").notEqual("613"))); Expression exp = employee.notExists(subQuery);
Note if employee has no phone numbers allOf ~ noneOf.
criteria
- must have its own builder, as it will become the
separate selection criteria of a subQuery.
public Expression and(Expression theExpression)
Example:
EclipseLink: employee.get("firstName").equal("Bob").and(employee.get("lastName").equal("Smith")) Java: (employee.getFirstName().equals("Bob")) && (employee.getLastName().equals("Smith")) SQL: F_NAME = 'Bob' AND L_NAME = 'Smith'
public Expression anyOf(java.lang.String attributeName)
Example:
Format | Equivalent |
---|---|
EclipseLink |
ReadAllQuery query = new ReadAllQuery(Employee.class); ExpressionBuilder builder = new ExpressionBuilder(); Expression exp = builder.get("id").equal("14858"); exp = exp.or(builder.anyOf("managedEmployees").get("firstName").equal("Bob")); |
Java | No direct equivalent |
SQL | SELECT DISTINCT ... WHERE (t2.MGR_ID (+) = t1.ID) AND (t2.F_NAME = 'Bob') |
public Expression anyOfAllowingNone(java.lang.String attributeName)
Example:
Format | Equivalent |
---|---|
EclipseLink |
ReadAllQuery query = new ReadAllQuery(Employee.class); ExpressionBuilder builder = new ExpressionBuilder(); Expression exp = builder.get("id").equal("14858"); exp = exp.or(builder.anyOfAllowingNone("managedEmployees").get("firstName").equal("Bob")); |
Java | No direct equivalent |
SQL | SELECT DISTINCT ... WHERE (t2.MGR_ID (+) = t1.ID) AND (t2.F_NAME = 'Bob') |
public Expression as(java.lang.Class castClass)
Example:
EclipseLink: employee.get("project").as(LargeProject.class).get("budget").equal(1000) Java: ((LargeProject)employee.getProjects().get(0)).getBudget() == 1000 SQL: LPROJ.PROJ_ID (+)= PROJ.PROJ_ID AND L_PROJ.BUDGET = 1000
public Expression ascending()
readAllQuery.addOrderBy(expBuilder.get("address").get("city").ascending())
public Expression asciiValue()
public Expression asOf(AsOfClause pastTime)
Example:
EclipseLink: employee.asOf(new AsOfClause(pastTime)) Java: None SQL (Flashback): SELECT ... FROM EMPLOYEE AS OF TIMESTAMP (pastTime) t0 ... SQL (Generic): .. WHERE (t1.START <= pastTime) AND ((t1.END IS NULL) OR t1.END > pastTime)
Set an as of clause at the expression level to still query for current objects while expressing selection criteria like:
Simultaneously querying on two versions of the same object (one past one present) lets you express these advanced selection criteria.
Example: Querying on past attributes using parallel expressions.
// Finds all employees who lived in Ottawa as of a past time. ExpressionBuilder employee = new ExpressionBuilder(); ExpressionBuilder pastEmployee = new ExpressionBuilder(Employee.class); pastEmployee.asOf(pastTime); Expression pastAddress = pastEmployee.get("address"); // by default address will also be as of past time. Expression selectionCriteria = pastAddress.get("city").equal("Ottawa").and( employee.equal(pastEmployee));
The advantage of the parallel expression is that you can still read current objects, the as of clause will affect only the where clause / selection criteria.
You may be tempted to rewrite the above as employee.get("address").asOf(pastTime). That is allowed but see below for the finer points involved in this.
Example: Querying on object changes using parallel expressions.
// Finds all employees who recently received a raise. Note that current // objects are returned, so can be cached normally. ExpressionBuilder employee = new ExpressionBuilder(); Expression pastEmployee = new ExpressionBuilder(Employee.class); pastEmployee.asOf(yesterday); Expression parallelJoin = employee.equal(pastEmployee); Expression selectionCriteria = parallelJoin.and( employee.get("salary").greaterThan(pastEmployee.get("salary")));
Example: Querying on object changes using custom query keys
// First define the custom query key and add it to your descriptor. ExpressionBuilder builder = new ExpressionBuilder(Employee.class); Expression joinCriteria = builder.getField("EMPLOYEE.EMP_ID").equal(builder.getParameter("EMPLOYEE.EMP_ID")); OneToOneQueryKey selfReferential = new OneToOneQueryKey(); selfReferential.setName("this"); selfReferential.setJoinCriteria(joinCriteria); selfReferential.setReferenceClass(Employee.class); getSession().getDescriptor(Employee.class).addQueryKey(selfReferential); // Now build query as before. Expression employee = new ExpessionBuilder(); Expression pastEmployee = employee.get("this").asOf(yesterday); Expression selectionCriteria = employee.get("salary").greaterThan(pastEmployee.get("salary"));
Note in general that any parallel expression can be rewritten using a custom query key. EclipseLink will even automatically interpret x.get("this") for you so you do not need to define the above query key first.
Full Reference:
If an object is mapped to multiple tables, then each table will be as of the same time. Two objects mapped to the same table can not have different as of times. Conversely only expressions which have associated tables can have an as of clause.
If an as of clause is not explicitly set an expression will use the clause of its base expression, and so on recursively until one is found or an ExpressionBuilder is reached. Some usage scenarios follow:
Watch out for x.asOf(oneTime).get("y").asOf(anotherTime).
pastTime
- A read only data object used to represent a past time.
this
AsOfClause
,
hasAsOfClause()
,
Session.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause)
,
org.eclipse.persistence.queries.ObjectLevelReadQuery#setAsOfClause(org.eclipse.persistence.history.AsOfClause))
protected void assignAlias(java.lang.String name, org.eclipse.persistence.internal.helper.DatabaseTable tableOrExpression)
public int assignTableAliasesStartingAt(int initialValue)
public Expression average()
public Expression between(byte leftValue, byte rightValue)
public Expression between(char leftChar, char rightChar)
public Expression between(double leftValue, double rightValue)
public Expression between(float leftValue, float rightValue)
public Expression between(int leftValue, int rightValue)
public Expression between(long leftValue, long rightValue)
public Expression between(java.lang.Object leftValue, java.lang.Object rightValue)
This is equivalent to the SQL "BETWEEN AND" operator and Java ">=", "<=;" operators.
Example:
EclipseLink: employee.get("age").between(19,50) Java: (employee.getAge() >= 19) && (employee.getAge() <= 50) SQL: AGE BETWEEN 19 AND 50
public Expression between(Expression leftExpression, Expression rightExpression)
public Expression between(short leftValue, short rightValue)
public Expression caseStatement(java.util.Map caseItems, java.lang.Object defaultItem)
Example:
Map caseTable = new HashMap(); caseTable.put("Robert", "Bob"); caseTable.put("Susan", "Sue"); EclipseLink: employee.get("name").caseStatement(caseTable, "No-Nickname") Java: NA SQL: CASE name WHEN "Robert" THEN "Bob" WHEN "Susan" THEN "Sue" ELSE "No-Nickname"
caseItems
- java.util.Map
A Map containing the items to be processed.
Keys represent the items to match coming from the query.
Values represent what a key will be changed to.defaultItem
- java.lang.String the default value that will be used if none of the keys in the
hashtable matchpublic org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression caseStatement()
This expression must be manipulated to successfully build a case statement by adding appropriate children to it. A child must be added for the "case expression" (name above), a pair of children must be added for each "when then" expression and a child must be added for the else.SQL: CASE name WHEN "Robert" THEN "Bob" WHEN "Susan" THEN "Sue" ELSE "No-Nickname"
ArgumentListFunctionExpression
public Expression caseConditionStatement(java.util.Map<Expression,java.lang.Object> caseConditions, java.lang.Object defaultItem)
Example:
Map caseTable = new HashMap(); caseTable.put(employee.get("name").equals("Robert"), "Bob"); caseTable.put(employee.get("name").equals("Susan"), "Sue"); EclipseLink: expressionBuilder.caseConditionStatement(caseTable, "No-Nickname") Java: NA SQL: CASE WHEN name = "Robert" THEN "Bob" WHEN name = "Susan" THEN "Sue" ELSE "No-Nickname"
caseItems
- java.util.Map
A Map containing the items to be processed.
Keys represent the items to match coming from the query.
Values represent what a key will be changed to.defaultItem
- java.lang.Object the default value that will be used if none of the keys in the
Map matchpublic org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression caseConditionStatement()
This expression must be manipulated to successfully build a case statement by adding appropriate children to it. A pair of children must be added for each "when then" expression and a child must be added for the else.SQL: CASE WHEN name = "Robert" THEN "Bob" WHEN name = "Susan" THEN "Sue" ELSE "No-Nickname"
ArgumentListFunctionExpression
public Expression nullIf(java.lang.Object object)
Example:
EclipseLink: builder.get("name").nullIf( "Bobby") Java: NA SQL: NULLIF(name, "Bobby")
defaultItem
- java.lang.Object the value/expression that will be compared to the base expressionpublic org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression coalesce(java.util.Collection expressions)
Example:
Vector list = new Vector(3); list.add(builder.get("firstName")); list.add(builder.get("lastName")); list.add(builder.get("nickname")); EclipseLink: expressionBuilder.coalesce(caseTable) Java: NA SQL: COALESCE(firstname, lastname, nickname)
caseItems
- java.util.Collection
A Collection containing the items to check if nullpublic org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression coalesce()
public java.lang.Object clone()
clone
in class java.lang.Object
public Expression cloneUsing(Expression newBase)
ForeignReferenceMapping.batchedValueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord, org.eclipse.persistence.queries.ObjectLevelReadQuery, org.eclipse.persistence.internal.identitymaps.CacheKey)
,
rebuildOn(Expression)
public Expression concat(java.lang.Object left)
public Expression containsAllKeyWords(java.lang.String spaceSeparatedKeyWords)
Example:
EclipseLink: project.get("description").containsAllKeyWords("EclipseLink rdbms java")
public Expression containsAnyKeyWords(java.lang.String spaceSeparatedKeyWords)
Example:
EclipseLink: project.get("description").containsAllKeyWords("EclipseLink rdbms java")
public Expression containsSubstring(java.lang.String theValue)
Example:
EclipseLink: employee.get("firstName").containsSubstring("Bob") Java: employee.getFirstName().indexOf("Bob") != -1 SQL: F_NAME LIKE '%BOB%'
public Expression containsSubstring(Expression expression)
Example:
EclipseLink: employee.get("firstName").containsSubstring("Bob") Java: employee.getFirstName().indexOf("Bob") != -1 SQL: F_NAME LIKE '%BOB%'
public Expression containsSubstringIgnoringCase(java.lang.String theValue)
Example:
EclipseLink: employee.get("firstName").containsSubstringIgnoringCase("Bob") Java: employee.getFirstName().toUpperCase().indexOf("BOB") != -1 SQL: F_NAME LIKE '%BOB%'
public Expression containsSubstringIgnoringCase(Expression expression)
Example:
EclipseLink: employee.get("firstName").containsSubstringIgnoringCase("Bob") Java: employee.getFirstName().toUpperCase().indexOf("BOB") != -1 SQL: F_NAME LIKE '%BOB%'
protected void convertNodeToUseOuterJoin()
public Expression convertToUseOuterJoin()
public Expression copiedVersionFrom(java.util.Map alreadyDone)
public Expression count()
public Expression create(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)
public Expression createWithBaseLast(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)
public Expression create(Expression base, java.util.Vector arguments, ExpressionOperator anOperator)
public Expression currentTimeStamp()
public Expression currentDate()
public Expression currentDateDate()
public Expression currentTime()
public Expression dateDifference(java.lang.String datePart, java.util.Date date)
Example:
*EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) Java: NA SQL: DATEADD(date, 2, GETDATE)
public Expression dateDifference(java.lang.String datePart, Expression comparisonExpression)
Example:
*EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) Java: NA SQL: DATEADD(date, 2, GETDATE)
public Expression dateName(java.lang.String datePart)
Example:
*EclipseLink: employee.get("date").dateName("year") Java: new String(date.getYear()) SQL: DATENAME(date, year)
public Expression datePart(java.lang.String datePart)
Example:
*EclipseLink: employee.get("date").datePart("year") Java: date.getYear() SQL: DATEPART(date, year)
public Expression dateToString()
public Expression decode(java.util.Map decodeableItems, java.lang.String defaultItem)
Example:
Map decodeTable = new HashMap(); decodeTable.put("Robert", "Bob"); decodeTable.put("Susan", "Sue"); EclipseLink: employee.get("name").Decode(decodeTable, "No-Nickname") Java: NA SQL: DECODE(name, "Robert", "Bob", "Susan", "Sue", "No-Nickname")
decodeableItems
- java.util.Map
a Map containing the items to be decoded. Keys represent
the items to match coming from the query. Values represent what
a key will be changed to.defaultItem
- the default value that will be used if none of the keys in the
Map matchpublic Expression descending()
Example:
readAllQuery.addOrderBy(expBuilder.get("address").get("city").descending())
public java.lang.String descriptionOfNodeType()
public boolean detectExpression(java.util.Vector theObjects)
public Expression difference(java.lang.String expression)
Example:
*EclipseLink: employee.get("name").difference("Frank") SQL: DIFFERENCE(name, 'Frank')
public Expression distinct()
public boolean doesConform(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy) throws QueryException
QueryException
public boolean doesConform(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy, boolean objectIsUnregistered) throws QueryException
objectIsUnregistered
- true if object possibly not a clone, but is being
conformed against the unit of work cache; if object is not in the UOW cache
but some of its attributes are, use the registered versions of
object's attributes for the purposes of this method.
QueryException
public boolean equals(java.lang.Object expression)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int computeHashCode()
public Expression equal(byte theValue)
public Expression equal(char theChar)
public Expression equal(double theValue)
public Expression equal(float theValue)
public Expression equal(int theValue)
public Expression equal(long theValue)
public Expression equal(java.lang.Object theValue)
Example:
EclipseLink: employee.get("firstName").equal("Bob") Java: employee.getFirstName().equals("Bob") SQL: F_NAME = 'Bob'
public Expression equal(Expression theValue)
Since OracleAS EclipseLink 10g (9.0.4) if this
is an ExpressionBuilder
and theValue
is not used elsewhere, both will be translated to the same table. This can
generate SQL with one less join for most exists subqueries.
Example:
EclipseLink: employee.get("manager").equal(employee) Java: employee.getManager().equals(employee) SQL (optimized): EMP_ID = MANAGER_ID SQL (unoptimized): t0.MANAGER_ID = t1.EMP_ID AND t0.EMP_ID = t1.EMP_ID
equal(Object)
public Expression equal(short theValue)
public Expression equal(boolean theBoolean)
public Expression equalOuterJoin(java.lang.Object theValue)
public Expression equalOuterJoin(Expression theValue)
public Expression equalsIgnoreCase(java.lang.String theValue)
Example:
EclipseLink: employee.get("firstName").equalsIgnoreCase("Bob") Java: employee.getFirstName().equalsIgnoreCase("Bob") SQL: UPPER(F_NAME) = 'BOB'
public Expression equalsIgnoreCase(Expression theValue)
Example:
EclipseLink: employee.get("firstName").equalsIgnoreCase("Bob") Java: employee.getFirstName().equalsIgnoreCase("Bob") SQL: UPPER(F_NAME) = 'BOB'
public Expression exists(ReportQuery subQuery)
Example:
ExpressionBuilder builder = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Employee.class, new ExpressionBuilder()); subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().get("name").equal(builder.get("name"))); builder.exists(subQuery);
public boolean extractPrimaryKeyValues(boolean requireExactMatch, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractRecord primaryKeyRow, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
public boolean extractPrimaryKeyFields(boolean requireExactMatch, ClassDescriptor descriptor, java.util.Set<org.eclipse.persistence.internal.helper.DatabaseField> fields)
public static Expression from(java.lang.Object value, Expression base)
public static Expression fromConstant(java.lang.Object value, Expression base)
public static Expression fromLiteral(java.lang.String value, Expression base)
public Expression get(java.lang.String attributeName)
Example:
builder.get("address").get("city").equal("Ottawa");
public Expression get(java.lang.String attributeName, java.util.Vector arguments)
public Expression getAllowingNull(java.lang.String attributeName)
Example:
builder.getAllowingNull("address").get("city").equal("Ottawa");
public Expression getAllowingNull(java.lang.String attributeName, java.util.Vector arguments)
public AsOfClause getAsOfClause()
null
if no clause set, AsOfClause.NO_CLAUSE
if
clause explicitly set to null
.asOf(org.eclipse.persistence.history.AsOfClause)
,
hasAsOfClause()
public AsOfClause getAsOfClauseRecursively()
public abstract ExpressionBuilder getBuilder()
public org.eclipse.persistence.internal.helper.DatabaseField getClonedField()
public Expression getField(java.lang.String fieldName)
Example:
builder.getField("ADDR_ID").greaterThan(100); builder.getTable("PROJ_EMP").getField("TYPE").equal("S");
public Expression getField(org.eclipse.persistence.internal.helper.DatabaseField field)
Example:
builder.getField(aField).greaterThan(100);
public java.util.Vector getFields()
public java.lang.Object getFieldValue(java.lang.Object objectValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
public Expression getFunction(int selector)
Example:
builder.get("name").getFunction(MyFunctions.FOO_BAR).greaterThan(100);
public Expression getFunction(int selector, java.util.Vector arguments)
Example:
Vector arguments = new Vector();
arguments.addElement("blee");
builder.get("name").getFunction(MyFunctions.FOO_BAR, arguments).greaterThan(100);
public Expression getFunction(java.lang.String functionName)
Example:
builder.get("firstName").getFunction("UPPER");
public Expression getFunction(java.lang.String functionName, java.lang.Object argument)
public Expression getFunctionWithArguments(java.lang.String functionName, java.util.Vector arguments)
public Expression type()
Example:
builder.getClassForInheritance().equal(SmallProject.class); builder.anyOf("projects").getClassForInheritance().equal(builder.getParameter("projectClass"));
public java.lang.String getName()
public ExpressionOperator getOperator()
public ExpressionOperator getOperator(int selector)
public java.util.Vector getOwnedTables()
public Expression getParameter(java.lang.String parameterName, java.lang.Object type)
public Expression getParameter(java.lang.String parameterName)
public Expression getParameter(org.eclipse.persistence.internal.helper.DatabaseField field)
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
public Expression getTable(java.lang.String tableName)
Example:
builder.getTable("PROJ_EMP").getField("TYPE").equal("S");
public Expression getTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
Example:
builder.getTable(linkTable).getField("TYPE").equal("S");
public org.eclipse.persistence.internal.expressions.TableAliasLookup getTableAliases()
public Expression greaterThan(byte theValue)
public Expression greaterThan(char theChar)
public Expression greaterThan(double theValue)
public Expression greaterThan(float theValue)
public Expression greaterThan(int theValue)
public Expression greaterThan(long theValue)
public Expression greaterThan(java.lang.Object theValue)
public Expression greaterThan(Expression theValue)
public Expression greaterThan(short theValue)
public Expression greaterThan(boolean theBoolean)
public Expression greaterThanEqual(byte theValue)
public Expression greaterThanEqual(char theChar)
public Expression greaterThanEqual(double theValue)
public Expression greaterThanEqual(float theValue)
public Expression greaterThanEqual(int theValue)
public Expression greaterThanEqual(long theValue)
public Expression greaterThanEqual(java.lang.Object theValue)
public Expression greaterThanEqual(Expression theValue)
public Expression greaterThanEqual(short theValue)
public Expression greaterThanEqual(boolean theBoolean)
public boolean hasAsOfClause()
this
is to be queried as of a past time.
asOf(null); hasAsOfClause()
.getAsOfClause()
public boolean hasBeenAliased()
public Expression hexToRaw()
public Expression ifNull(java.lang.Object nullValue)
Example:
EclipseLink: employee.get("name").ifNull("no-name") Java: NA SQL: NVL(name, 'no-name')
public Expression in(byte[] theBytes)
public Expression in(char[] theChars)
public Expression in(double[] theDoubles)
public Expression in(float[] theFloats)
public Expression in(int[] theInts)
public Expression in(long[] theLongs)
public Expression in(java.lang.Object[] theObjects)
public Expression in(short[] theShorts)
public Expression in(boolean[] theBooleans)
public Expression in(java.util.Collection theObjects)
Example:
EclipseLink: employee.get("age").in(agesVector) Java: agesVector.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
public Expression in(Expression arguments)
public Expression in(ReportQuery subQuery)
public Expression index()
public Expression indexOf(java.lang.Object substring)
public boolean isClassTypeExpression()
public boolean isCompoundExpression()
public boolean isConstantExpression()
public boolean isDataExpression()
public Expression isEmpty(java.lang.String attributeName)
attributeName
being empty.
Equivalent to size(attributeName).equal(0)
Example:
This is a case where a fast operation in java does not translate to an equally fast operation in SQL, requiring a correlated subselect.EclipseLink: employee.isEmpty("phoneNumbers") Java: employee.getPhoneNumbers().size() == 0 SQL: SELECT ... FROM EMP t0 WHERE ( (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID)) = 0)
size(java.lang.String)
public boolean isExpressionBuilder()
public boolean isFieldExpression()
public boolean isFunctionExpression()
public boolean isLiteralExpression()
public boolean isLogicalExpression()
public Expression isNull()
public boolean isObjectExpression()
public boolean isParameterExpression()
public boolean isQueryKeyExpression()
public boolean isRelationExpression()
public boolean isTableExpression()
public boolean isMapEntryExpression()
public boolean isValueExpression()
public void iterateOn(org.eclipse.persistence.internal.expressions.ExpressionIterator iterator)
public Expression lastDay()
public Expression leftPad(int size, java.lang.Object substring)
public Expression leftPad(java.lang.Object size, java.lang.Object substring)
public Expression leftTrim()
public Expression leftTrim(java.lang.Object substring)
public Expression length()
public Expression lessThan(byte theValue)
public Expression lessThan(char theChar)
public Expression lessThan(double theValue)
public Expression lessThan(float theValue)
public Expression lessThan(int theValue)
public Expression lessThan(long theValue)
public Expression lessThan(java.lang.Object theValue)
public Expression lessThan(Expression theValue)
public Expression lessThan(short theValue)
public Expression lessThan(boolean theBoolean)
public Expression lessThanEqual(byte theValue)
public Expression lessThanEqual(char theChar)
public Expression lessThanEqual(double theValue)
public Expression lessThanEqual(float theValue)
public Expression lessThanEqual(int theValue)
public Expression lessThanEqual(long theValue)
public Expression lessThanEqual(java.lang.Object theValue)
public Expression lessThanEqual(Expression theValue)
public Expression lessThanEqual(short theValue)
public Expression lessThanEqual(boolean theBoolean)
public Expression like(java.lang.String value)
Example:
EclipseLink: employee.get("firstName").like("B%") Java: NA SQL: F_NAME LIKE 'B%'
public Expression like(java.lang.String value, java.lang.String escapeSequence)
Example:
EclipseLink: employee.get("firstName").like("B\_SMITH", "\") Java: NA SQL: F_NAME LIKE 'B\_SMITH ESCAPE '\''
public Expression like(Expression argument)
Example:
EclipseLink: employee.get("firstName").like("B%") Java: NA SQL: F_NAME LIKE 'B%'
public Expression like(Expression value, Expression escapeSequence)
Example:
EclipseLink: employee.get("firstName").like("B\_SMITH", "\") Java: NA SQL: F_NAME LIKE 'B\_SMITH ESCAPE '\''
public Expression likeIgnoreCase(java.lang.String theValue)
Example:
EclipseLink: employee.get("firstName").likeIgnoreCase("%Bob%") Java: none SQL: UPPER(F_NAME) LIKE '%BOB%'
public Expression likeIgnoreCase(Expression theValue)
public Expression locate(java.lang.Object str)
str
in this
Example:
EclipseLink: employee.get("firstName").locate("ob") Java: employee.getFirstName().indexOf("ob") + 1 SQL: LOCATE('ob', t0.F_NAME)
Note that while in String.locate(str) -1 is returned if not found, and the index starting at 0 if found, in SQL it is 0 if not found, and the index starting at 1 if found.
public Expression locate(java.lang.String str, int fromIndex)
str
in this
,
starting the search at fromIndex
.
Example:
EclipseLink: employee.get("firstName").locate("ob", 1) Java: employee.getFirstName().indexOf("ob", 1) + 1 SQL: LOCATE('ob', t0.F_NAME, 1)
Note that while in String.locate(str) -1 is returned if not found, and the index starting at 0 if found, in SQL it is 0 if not found, and the index starting at 1 if found.
public Expression locate(java.lang.Object str, java.lang.Object fromIndex)
str
in this
,
starting the search at fromIndex
.
Example:
EclipseLink: employee.get("firstName").locate("ob", 1) Java: employee.getFirstName().indexOf("ob", 1) + 1 SQL: LOCATE('ob', t0.F_NAME, 1)
Note that while in String.locate(str) -1 is returned if not found, and the index starting at 0 if found, in SQL it is 0 if not found, and the index starting at 1 if found.
public Expression maximum()
public Expression minimum()
public Expression monthsBetween(java.lang.Object otherDate)
public Expression mapEntry()
public Expression mapKey()
public Expression newTime(java.lang.String timeZoneFrom, java.lang.String timeZoneTo)
Example:
*EclipseLink: employee.get("date").newTime("EST", "PST") Java: NA SQL: NEW_TIME(date, 'EST', 'PST')
public Expression nextDay(java.lang.Object dayName)
public Expression noneOf(java.lang.String attributeName, Expression criteria)
attributeName
holding true for criteria
.
For every expression with an anyOf, its negation has either an allOf or a noneOf. The following two examples will illustrate as the second is the negation of the first:
AnyOf Example: Employees with a '613' area code phone number.
ReadAllQuery query = new ReadAllQuery(Employee.class); ExpressionBuilder employee = new ExpressionBuilder(); Expression exp = employee.anyOf("phoneNumbers").get("areaCode").equal("613");
NoneOf Example: Employees with no '613' area code phone numbers.
ExpressionBuilder employee = new ExpressionBuilder(); ExpressionBuilder phones = new ExpressionBuilder(); Expression exp = employee.noneOf("phoneNumbers", phones.get("areaCode").equal("613")); SQL: SELECT ... EMPLOYEE t0 WHERE NOT EXISTS (SELECT ... PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID) AND (t1.AREACODE = '613'))
noneOf is the universal counterpart to the existential anyOf. To have the condition evaluated for each instance it must be put inside of a subquery, which can be expressed as not exists (any of attributeName some condition). (All x such that !y = !Exist x such that y).
Likewise the syntax employee.noneOf("phoneNumbers").get("areaCode").equal("613")
is not supported for the equal
must go inside a subQuery.
This method saves you from writing the sub query yourself. The above is equivalent to the following expression:
ExpressionBuilder employee = new ExpressionBuilder(); ExpressionBuilder phone = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Phone.class, phone); subQuery.retreivePrimaryKeys(); subQuery.setSelectionCriteria(phone.equal(employee.anyOf("phoneNumbers").and( phone.get("areaCode").equal("613"))); Expression exp = employee.notExists(subQuery);
criteria
- must have its own builder, as it will become the
separate selection criteria of a subQuery.
public Expression normalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)
public Expression not()
Example:
EclipseLink: employee.get("age").equal(24).not() Java: (! (employee.getAge() == 24)) SQL: NOT (AGE = 24)
public Expression notBetween(byte leftValue, byte rightValue)
between(Object, Object)
public Expression notBetween(char leftChar, char rightChar)
between(Object, Object)
public Expression notBetween(double leftValue, double rightValue)
between(Object, Object)
public Expression notBetween(float leftValue, float rightValue)
between(Object, Object)
public Expression notBetween(int leftValue, int rightValue)
between(Object, Object)
public Expression notBetween(long leftValue, long rightValue)
between(Object, Object)
public Expression notBetween(java.lang.Object leftValue, java.lang.Object rightValue)
between(Object, Object)
public Expression notBetween(Expression leftExpression, Expression rightExpression)
between(Object, Object)
public Expression notBetween(short leftValue, short rightValue)
between(Object, Object)
public Expression notEmpty(java.lang.String attributeName)
attributeName
not being empty.
Equivalent to size(attributeName).greaterThan(0)
Example:
This is a case where a fast operation in java does not translate to an equally fast operation in SQL, requiring a correlated subselect.EclipseLink: employee.notEmpty("phoneNumbers") Java: employee.getPhoneNumbers().size() > 0 SQL: SELECT ... FROM EMP t0 WHERE ( (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID)) > 0)
size(java.lang.String)
public Expression notEqual(byte theValue)
equal(Object)
public Expression notEqual(char theChar)
equal(Object)
public Expression notEqual(double theValue)
equal(Object)
public Expression notEqual(float theValue)
equal(Object)
public Expression notEqual(int theValue)
equal(Object)
public Expression notEqual(long theValue)
equal(Object)
public Expression notEqual(java.lang.Object theValue)
equal(Object)
public Expression notEqual(Expression theValue)
equal(Object)
public Expression notEqual(short theValue)
equal(Object)
public Expression notEqual(boolean theBoolean)
equal(Object)
public Expression notExists(ReportQuery subQuery)
Example:
ExpressionBuilder builder = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Employee.class, new ExpressionBuilder()); subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().get("name").equal(builder.get("name"))); builder.notExists(subQuery);
public Expression notIn(byte[] theBytes)
public Expression notIn(char[] theChars)
public Expression notIn(double[] theDoubles)
public Expression notIn(float[] theFloats)
public Expression notIn(int[] theInts)
public Expression notIn(long[] theLongs)
public Expression notIn(java.lang.Object[] theObjects)
public Expression notIn(ReportQuery subQuery)
public Expression notIn(short[] theShorts)
public Expression notIn(boolean[] theBooleans)
public Expression notIn(java.util.Collection theObjects)
Example:
EclipseLink: employee.get("age").in(agesVector) Java: agesVector.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
public Expression notIn(Expression arguments)
public Expression notLike(java.lang.String aString)
like(String)
public Expression notLike(Expression arguments)
like(String)
public Expression notLike(java.lang.String value, java.lang.String escapeSequence)
value
- string to compareescapeSequence
- the escape character to uselike(String)
public Expression notLike(Expression value, Expression escapeSequence)
value
- string to compareescapeSequence
- the escape character to uselike(String)
public Expression notNull()
Example:
EclipseLink: employee.get("age").notNull() Java: employee.getAge() != null SQL: AGE IS NOT NULL
public Expression or(Expression theExpression)
Example:
EclipseLink: employee.get("firstName").equal("Bob").OR(employee.get("lastName").equal("Smith")) Java: (employee.getFirstName().equals("Bob")) || (employee.getLastName().equals("Smith")) SQL: F_NAME = 'Bob' OR L_NAME = 'Smith'
public Expression performOperator(ExpressionOperator anOperator, java.util.Vector args)
protected void postCopyIn(java.util.Map alreadyDone)
public Expression postfixSQL(java.lang.String sqlString)
public Expression prefixSQL(java.lang.String sqlString)
public abstract void printSQL(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer)
public void printJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)
public abstract Expression rebuildOn(Expression newBase)
cloneUsing(Expression newBase)
public abstract void resetPlaceHolderBuilder(ExpressionBuilder queryBuilder)
public Expression ref()
protected Expression registerIn(java.util.Map alreadyDone)
public Expression replace(java.lang.Object stringToReplace, java.lang.Object stringToReplaceWith)
public Expression replicate(int constant)
Example:
EclipseLink: employee.get("name").replicate(2) Java: NA SQL: REPLICATE(name, 2)
public Expression replicate(java.lang.Object theValue)
Example:
EclipseLink: employee.get("name").replicate(2) Java: NA SQL: REPLICATE(name, 2)
protected void resetCache()
public Expression reverse()
Example:
EclipseLink: employee.get("name").reverse() Java: NA SQL: REVERSE(name)
public Expression right(int characters)
Example:
EclipseLink: employee.get("name").right(2) Java: NA SQL: RIGHT(name, 2)
public Expression right(java.lang.Object characters)
Example:
EclipseLink: employee.get("name").right(2) Java: NA SQL: RIGHT(name, 2)
public Expression rightPad(int size, java.lang.Object substring)
public Expression rightPad(java.lang.Object size, java.lang.Object substring)
public Expression rightTrim()
public Expression rightTrim(java.lang.Object substring)
public Expression roundDate(java.lang.Object yearOrMonthOrDayRoundToken)
public boolean selectIfOrderedBy()
public void setLocalBase(Expression exp)
public void setSelectIfOrderedBy(boolean selectIfOrderedBy)
selectIfOrderedBy
- public Expression shallowClone()
public Expression size(java.lang.String attributeName)
attributeName
.
Example:
This is a case where a fast operation in java does not translate to an equally fast operation in SQL, requiring a correlated subselect.EclipseLink: employee.size("phoneNumbers") Java: employee.getPhoneNumbers().size() SQL: SELECT ... FROM EMP t0 WHERE ... (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID))
public Expression size(java.lang.Class returnType)
Example:
This is a case where a fast operation in java does not translate to an equally fast operation in SQL, requiring a correlated subselect.EclipseLink: employee.size(Class returnType) Java: employee.getPhoneNumbers().size() SQL: SELECT ... FROM EMP t0 WHERE ... (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID))
public Expression standardDeviation()
public Expression subQuery(ReportQuery subQuery)
Example:
ExpressionBuilder builder = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Employee.class, new ExpressionBuilder()); subQuery.addMaximum("salary"); builder.get("salary").equal(builder.subQuery(subQuery));
public Expression substring(int startPosition, int size)
public Expression substring(java.lang.Object startPosition, java.lang.Object size)
public Expression substring(int startPosition)
public Expression substring(java.lang.Object startPosition)
public Expression sum()
public Expression toCharacter()
public Expression toDate()
public Expression toChar()
Example:
EclipseLink: employee.get("salary").toChar().equal("100000") Java: employee.getSalary().toString().equals("100000") SQL: TO_CHAR(SALARY) = '100000'
public Expression toChar(java.lang.String format)
Example:
EclipseLink: employee.get("startDate").toChar("day").equal("monday") Java: employee.getStartDate().getDay().equals("monday") SQL: TO_CHAR(START_DATE, 'day') = 'monday'
public Expression toLowerCase()
Example:
EclipseLink: employee.get("firstName").toLowerCase().equal("bob") Java: employee.getFirstName().toLowerCase().equals("bob") SQL: LOWER(F_NAME) = 'bob'
public Expression toNumber()
public java.lang.String toString()
toString
in class java.lang.Object
public void toString(java.io.BufferedWriter writer, int indent) throws java.io.IOException
java.io.IOException
public Expression toUpperCase()
Example:
EclipseLink: employee.get("firstName").toUpperCase().equal("BOB") Java: employee.getFirstName().toUpperCase().equals("BOB") SQL: UPPER(F_NAME) = 'BOB'
public Expression toUppercaseCasedWords()
public Expression translate(java.lang.Object fromString, java.lang.Object toString)
public Expression trim()
public Expression trim(java.lang.Object substring)
public Expression extract(java.lang.String xpath)
xpath
- XPath expression representing the node to be returnedpublic Expression extractValue(java.lang.String xpath)
xpath
- XPath expressionpublic Expression existsNode(java.lang.String xpath)
xpath
- Xpath expressionpublic Expression isFragment()
public Expression getStringVal()
public Expression getNumberVal()
public Expression truncateDate(java.lang.String datePart)
Example:
EclipseLink: employee.get("date").truncDate(year) Java: NA SQL: TRUNC(date, year)
public Expression twist(Expression expression, Expression newBase)
public Expression twistedForBaseAndContext(Expression newBase, Expression context)
public void validateNode()
public Expression value()
public Expression value(byte constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(char constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(double constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(float constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(int constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(long constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(java.lang.Object constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(short constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression value(boolean constant)
Example:
reportQuery.addItem("a constant", builder.value("a constant"));
public Expression literal(java.lang.String literal)
Example:
reportQuery.addItem("currentTime", builder.literal("SYSDATE"));
public java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)
isObjectUnregistered
- true if object possibly not a clone, but is being
conformed against the unit of work cache.public java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy)
public Expression variance()
public void writeDescriptionOn(java.io.BufferedWriter writer) throws java.io.IOException
java.io.IOException
protected void writeField(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
protected void writeAlias(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
public void writeFields(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, java.util.Vector newFields, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
public void writeSubexpressionsTo(java.io.BufferedWriter writer, int indent) throws java.io.IOException
java.io.IOException
public Expression any(byte[] theBytes)
public Expression any(char[] theChars)
public Expression any(double[] theDoubles)
public Expression any(float[] theFloats)
public Expression any(int[] theInts)
public Expression any(long[] theLongs)
public Expression any(java.lang.Object[] theObjects)
public Expression any(short[] theShorts)
public Expression any(boolean[] theBooleans)
public Expression any(java.util.Vector theObjects)
Example:
EclipseLink: employee.get("age").in(agesVector) Java: agesVector.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
public Expression any(Expression arguments)
public Expression any(ReportQuery subQuery)
public Expression some(byte[] theBytes)
public Expression some(char[] theChars)
public Expression some(double[] theDoubles)
public Expression some(float[] theFloats)
public Expression some(int[] theInts)
public Expression some(long[] theLongs)
public Expression some(java.lang.Object[] theObjects)
public Expression some(short[] theShorts)
public Expression some(boolean[] theBooleans)
public Expression some(java.util.Vector theObjects)
Example:
EclipseLink: employee.get("age").in(agesVector) Java: agesVector.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
public Expression some(Expression arguments)
public Expression some(ReportQuery subQuery)
public Expression all(byte[] theBytes)
public Expression all(char[] theChars)
public Expression all(double[] theDoubles)
public Expression all(float[] theFloats)
public Expression all(int[] theInts)
public Expression all(long[] theLongs)
public Expression all(java.lang.Object[] theObjects)
public Expression all(short[] theShorts)
public Expression all(boolean[] theBooleans)
public Expression all(java.util.Vector theObjects)
Example:
EclipseLink: employee.get("age").in(agesVector) Java: agesVector.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
public Expression all(Expression arguments)
public Expression all(ReportQuery subQuery)
|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |