Class Expression
- java.lang.Object
-
- org.eclipse.persistence.expressions.Expression
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
org.eclipse.persistence.internal.expressions.BaseExpression
public abstract class Expression extends java.lang.Object implements java.io.Serializable, java.lang.CloneablePurpose: 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:
- Store the selection criteria in a tree-like structure.
- Support public manipulation protocols for all comparison and function operators.
- Use operator overloading to support all primitive types as well as objects.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.persistence.internal.helper.DatabaseTablecurrentAliasprotected inthashCodePERF: Cache the hashCode.protected org.eclipse.persistence.internal.helper.DatabaseTablelastTableTemporary values for table aliasingprotected booleanselectIfOrderedBystatic booleanshouldUseUpperCaseForIgnoreCaseUse the upper() function for case insensitive expression operations (default).
-
Constructor Summary
Constructors Constructor Description Expression()Base Expression Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ExpressionaddDate(java.lang.String datePart, int numberToAdd)PUBLIC: Function, return an expression that adds to a date based on the specified datePart.ExpressionaddDate(java.lang.String datePart, java.lang.Object numberToAdd)PUBLIC: Function, return an expression that adds to a date based on the specified datePart.ExpressionaddMonths(int months)PUBLIC: Function, to add months to a date.ExpressionaddMonths(java.lang.Object months)PUBLIC: Function, to add months to a date.Expressionalias(java.lang.String alias)ADVANCED: Return an expression for the alias.org.eclipse.persistence.internal.helper.DatabaseTablealiasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)INTERNAL: Find the alias for a given tableExpressionall(boolean[] theBooleans)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(byte[] theBytes)PUBLIC: Return an expression that is used with a comparison expression.Expressionall(char[] theChars)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(double[] theDoubles)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(float[] theFloats)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(int[] theInts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(long[] theLongs)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(short[] theShorts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(java.lang.Object[] theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(java.util.List theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionall(java.util.Vector theObjects)Deprecated.since 2.4 replaced by all(List)Expressionall(Expression arguments)Expressionall(ReportQuery subQuery)ExpressionallOf(java.lang.String attributeName, Expression criteria)PUBLIC: Returns an expression equivalent to all ofattributeNameholding true forcriteria.Expressionand(Expression theExpression)PUBLIC: Return an expression that is the boolean logical combination of both expressions.Expressionany(boolean[] theBooleans)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(byte[] theBytes)PUBLIC: Return an expression that is used with a comparison expression.Expressionany(char[] theChars)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(double[] theDoubles)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(float[] theFloats)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(int[] theInts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(long[] theLongs)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(short[] theShorts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(java.lang.Object[] theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(java.util.List theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionany(java.util.Vector theObjects)Deprecated.since 2.4 replaced by any(List)Expressionany(Expression arguments)Expressionany(ReportQuery subQuery)ExpressionanyOf(java.lang.String attributeName)PUBLIC: Return an expression representing traversal of a 1:many or many:many relationship.ExpressionanyOf(java.lang.String attributeName, boolean shouldJoinBeIndependent)ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship.ExpressionanyOfAllowingNone(java.lang.String attributeName)ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship.ExpressionanyOfAllowingNone(java.lang.String attributeName, boolean shouldJoinBeIndependent)ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship.Expressionas(java.lang.Class castClass)Deprecated.replaced bytreat(Class)Expressionas(java.lang.String alias)ADVANCED: Assign an alias to the expression in the select clause.Expressionascending()PUBLIC: This can only be used within an ordering expression.ExpressionasciiValue()PUBLIC: Function, returns the single character strings ascii value.ExpressionasOf(AsOfClause pastTime)Sets all tables represented by this expression to be queried as of a past time.protected voidassignAlias(java.lang.String name, org.eclipse.persistence.internal.helper.DatabaseTable tableOrExpression)INTERNAL: Alias a particular table within this nodeintassignTableAliasesStartingAt(int initialValue)INTERNAL: Assign aliases to any tables which I own.Expressionaverage()PUBLIC: Function, This represents the aggregate function Average.Expressionbetween(byte leftValue, byte rightValue)PUBLIC: Function, between two bytesExpressionbetween(char leftChar, char rightChar)PUBLIC: Function, between two charsExpressionbetween(double leftValue, double rightValue)PUBLIC: Function, between two doublesExpressionbetween(float leftValue, float rightValue)PUBLIC: Function, between two floatsExpressionbetween(int leftValue, int rightValue)PUBLIC: Function, between two intsExpressionbetween(long leftValue, long rightValue)PUBLIC: Function, between two longsExpressionbetween(short leftValue, short rightValue)PUBLIC: Function, between two shortsExpressionbetween(java.lang.Object leftValue, java.lang.Object rightValue)PUBLIC: Return an expression that compares if the receiver's value is between two other values.Expressionbetween(Expression leftExpression, Expression rightExpression)org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpressioncaseConditionStatement()INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form:ExpressioncaseConditionStatement(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.ArgumentListFunctionExpressioncaseStatement()INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form:ExpressioncaseStatement(java.util.Map caseItems, java.lang.Object defaultItem)PUBLIC: Function Convert values returned by the query to values given in the caseItems Map.Expressioncast(java.lang.String type)PUBLIC: Cast the value to the database type.java.lang.Objectclone()INTERNAL: Clone the expression maintaining clone identity in the inter-connected expression graph.ExpressioncloneUsing(Expression newBase)INTERNAL: This expression is built on a different base than the one we want.org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpressioncoalesce()org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpressioncoalesce(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 functionintcomputeHashCode()INTERNAL: Compute a consistent hash-code for the expression.Expressionconcat(java.lang.Object left)PUBLIC: Function, returns the concatenation of the two string values.ExpressioncontainsAllKeyWords(java.lang.String spaceSeparatedKeyWords)PUBLIC: Return an expression that performs a key word search.ExpressioncontainsAnyKeyWords(java.lang.String spaceSeparatedKeyWords)PUBLIC: Return an expression that performs a key word search.ExpressioncontainsSubstring(java.lang.String theValue)PUBLIC: Return an expression that compares if the receivers value contains the substring.ExpressioncontainsSubstring(Expression expression)PUBLIC: Return an expression that compares if the receivers value contains the substring.ExpressioncontainsSubstringIgnoringCase(java.lang.String theValue)PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case.ExpressioncontainsSubstringIgnoringCase(Expression expression)PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case.protected voidconvertNodeToUseOuterJoin()ExpressionconvertToUseOuterJoin()INTERNAL: Modify this expression to use outer joins wherever there are equality operations between two field nodes.ExpressioncopiedVersionFrom(java.util.Map alreadyDone)INTERNAL:Expressioncount()PUBLIC: This represents the aggregate function Average.Expressioncreate(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)INTERNAL:Expressioncreate(Expression base, java.util.List arguments, ExpressionOperator anOperator)INTERNAL:ExpressioncreateWithBaseLast(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)INTERNAL:ExpressioncurrentDate()PUBLIC: This gives access to the current date on the database through expression.ExpressioncurrentDateDate()PUBLIC: This gives access to the current date only on the database through expression.ExpressioncurrentTime()PUBLIC: This gives access to the current time only on the database through expression.ExpressioncurrentTimeStamp()PUBLIC: This gives access to the current timestamp on the database through expression.ExpressiondateDifference(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.)ExpressiondateDifference(java.lang.String datePart, Expression comparisonExpression)PUBLIC: Function, Return the difference between the queried part of a date(i.e. years, days etc.)ExpressiondateName(java.lang.String datePart)PUBLIC: return a string that represents the given part of a date.ExpressiondatePart(java.lang.String datePart)PUBLIC: Function return an integer which represents the requested part of the date.ExpressiondateToString()PUBLIC: Function, returns the date converted to the string value in the default database format.Expressiondecode(java.util.Map decodeableItems, java.lang.String defaultItem)PUBLIC: Function Convert values returned by the query to values given in the decodeableItems Map.Expressiondescending()PUBLIC: This can only be used within an ordering expression.java.lang.StringdescriptionOfNodeType()INTERNAL: Used in debug printing of this node.Expressiondifference(java.lang.String expression)PUBLIC: Function return a value which indicates how much difference there is between two expressions.Expressiondistinct()PUBLIC: Function, This represents the distinct option inside an aggregate function.booleandoesConform(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.booleandoesConform(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 2612601Expressionequal(boolean theBoolean)Expressionequal(byte theValue)Expressionequal(char theChar)Expressionequal(double theValue)Expressionequal(float theValue)Expressionequal(int theValue)Expressionequal(long theValue)Expressionequal(short theValue)Expressionequal(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receiver's value is equal to the other value.Expressionequal(Expression theValue)Returns an expression that compares if the receiver's value is equal to the other value.ExpressionequalOuterJoin(java.lang.Object theValue)INTERNAL: Return an expression representing an outer join comparisonExpressionequalOuterJoin(Expression theValue)INTERNAL: Return an expression representing an outer join comparisonbooleanequals(java.lang.Object expression)INTERNAL: Return if the expression is equal to the other.ExpressionequalsIgnoreCase(java.lang.String theValue)PUBLIC: Return an expression that compares if the receiver's value is equal to the other value, ignoring case.ExpressionequalsIgnoreCase(Expression theValue)PUBLIC: Return an expression that compares if the receiver's value is equal to the other value, ignoring case.Expressionexcept(Expression arguments)PUBLIC: Return a except expression with the subquery.Expressionexcept(ReportQuery query)PUBLIC: Return a except expression with the subquery.ExpressionexceptAll(Expression arguments)PUBLIC: Return a except all expression with the subquery.ExpressionexceptAll(ReportQuery query)PUBLIC: Return a except all expression with the subquery.Expressionexists(ReportQuery subQuery)PUBLIC: Return a sub query expression.ExpressionexistsNode(java.lang.String xpath)PUBLIC: XMLType Function, gets the number of nodes returned by the given xpath expression returns 0 if there are noneExpressionextract(java.lang.String part)PUBLIC: Extract the date part from the date/time value.booleanextractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> searchFields, java.util.Set<org.eclipse.persistence.internal.helper.DatabaseField> foundFields)INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.booleanextractPrimaryKeyValues(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.ExpressionextractValue(java.lang.String xpath)PUBLIC: XMLType Function, extracts a value from an XMLType fieldbooleanextractValues(boolean primaryKeyOnly, 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.ExpressionextractXml(java.lang.String xpath)PUBLIC: XMLType Function, extracts a secton of XML from a larget XML documentstatic Expressionfrom(java.lang.Object value, Expression base)INTERNAL: Create an expression node.static ExpressionfromConstant(java.lang.Object value, Expression base)INTERNAL: Create an expression node.static ExpressionfromLiteral(java.lang.String value, Expression base)INTERNAL: Create an expression node.Expressionget(java.lang.String attributeName)PUBLIC: Return an expression that wraps the attribute or query key name.Expressionget(java.lang.String attributeName, boolean forceInnerJoin)PUBLIC: Return an expression that wraps the attribute or query key name.ExpressiongetAlias(Expression subSelect)ADVANCED: Return an expression representing a sub-select in the from clause.ExpressiongetAllowingNull(java.lang.String attributeName)ADVANCED: Return an expression that wraps the attribute or query key name.AsOfClausegetAsOfClause()Answers the past time the expression is explicitly as of.AsOfClausegetAsOfClauseRecursively()INTERNAL: For Flashback: If this expression is not already as of some timestamp gets the clause from the base expression.abstract ExpressionBuildergetBuilder()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.DatabaseFieldgetClonedField()INTERNAL: If there are any fields associated with this expression, return themExpressiongetField(java.lang.String fieldName)ADVANCED: Return an expression representing a field in a data-level query.ExpressiongetField(org.eclipse.persistence.internal.helper.DatabaseField field)ADVANCED: Return an expression representing a field in a data-level query.java.util.VectorgetFields()INTERNAL:java.lang.ObjectgetFieldValue(java.lang.Object objectValue, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Transform the object-level value into a database-level valueExpressiongetFunction(int selector)ADVANCED: This can be used for accessing user defined functions.ExpressiongetFunction(int selector, java.util.List arguments)ADVANCED: This can be used for accessing user defined functions that have arguments.ExpressiongetFunction(int selector, java.util.Vector arguments)Deprecated.ExpressiongetFunction(java.lang.String functionName)ADVANCED: Return a user defined function accepting the argument.ExpressiongetFunction(java.lang.String functionName, java.lang.Object argument)ADVANCED: Return a user defined function accepting the argument.ExpressiongetFunctionWithArguments(java.lang.String functionName, java.util.List arguments)ADVANCED: Return a user defined function accepting all of the arguments.ExpressiongetFunctionWithArguments(java.lang.String functionName, java.util.Vector arguments)Deprecated.ClassDescriptorgetLeafDescriptor(DatabaseQuery query, ClassDescriptor rootDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Lookup the descriptor for this item by traversing its expression recursively.DatabaseMappinggetLeafMapping(DatabaseQuery query, ClassDescriptor rootDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Lookup the mapping for this item by traversing its expression recursively.java.lang.StringgetName()INTERNAL:ExpressiongetNumberVal()PUBLIC: XMLType Function - gets a number value from an XMLTypeExpressionOperatorgetOperator()INTERNAL: Most expression have operators, so this is just a convenience method.static ExpressionOperatorgetOperator(int selector)INTERNAL: Create a new expression tree with the named operator.java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable>getOwnedTables()INTERNAL: Return the tables that this node owns for purposes of table aliasing.ExpressiongetParameter(java.lang.String parameterName)ADVANCED: Return an expression representing a parameter with the given name.ExpressiongetParameter(java.lang.String parameterName, java.lang.Object type)INTERNAL: Return an expression representing a parameter with the given name and typeExpressiongetParameter(org.eclipse.persistence.internal.helper.DatabaseField field)ADVANCED: Return an expression representing a parameter with the given name.ExpressiongetProperty(org.eclipse.persistence.internal.helper.DatabaseField field)ADVANCED: Return an expression representing a property with the given name.java.util.List<org.eclipse.persistence.internal.helper.DatabaseField>getSelectionFields()INTERNAL:java.util.List<org.eclipse.persistence.internal.helper.DatabaseField>getSelectionFields(ReadQuery query)org.eclipse.persistence.internal.sessions.AbstractSessiongetSession()INTERNAL:ExpressiongetStringVal()PUBLIC: XMLType Function - gets a string value from an XMLTypeExpressiongetTable(java.lang.String tableName)ADVANCED: Return an expression representing a table in a data-level query.ExpressiongetTable(org.eclipse.persistence.internal.helper.DatabaseTable table)ADVANCED: Return an expression representing a table in a data-level query.org.eclipse.persistence.internal.expressions.TableAliasLookupgetTableAliases()INTERNAL: Return the aliases used.ExpressiongreaterThan(boolean theBoolean)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(byte theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(char theChar)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(double theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(float theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(int theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(long theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(short theValue)PUBLIC: Return an expression that compares if the receivers value is equal to the other value.ExpressiongreaterThan(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receiver's value is greater than the other value.ExpressiongreaterThan(Expression theValue)ExpressiongreaterThanEqual(boolean theBoolean)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(byte theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(char theChar)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(double theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(float theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(int theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(long theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(short theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.ExpressiongreaterThanEqual(Expression theValue)PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value.booleanhasAsOfClause()ADVANCED: Answers true ifthisis to be queried as of a past time.booleanhasBeenAliased()INTERNAL: Answers if the database tables associated with this expression have been aliased.inthashCode()INTERNAL: Return a consistent hash-code for the expression.ExpressionhexToRaw()PUBLIC: Function, returns binary array value for the hex string.ExpressionifNull(java.lang.Object nullValue)PUBLIC: Function return a specific value if item returned from the query is null.Expressionin(boolean[] theBooleans)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(byte[] theBytes)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(char[] theChars)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(double[] theDoubles)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(float[] theFloats)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(int[] theInts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(long[] theLongs)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(short[] theShorts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(java.lang.Object[] theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(java.util.Collection theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionin(Expression arguments)Expressionin(ReportQuery subQuery)Expressionindex()ExpressionindexOf(java.lang.Object substring)PUBLIC: Function, returns the integer index of the substring within the source string.Expressionintersect(Expression arguments)PUBLIC: Return a intersect expression with the subquery.Expressionintersect(ReportQuery query)PUBLIC: Return a intersect expression with the subquery.ExpressionintersectAll(Expression arguments)PUBLIC: Return a intersect all expression with the subquery.ExpressionintersectAll(ReportQuery query)PUBLIC: Return a intersect all expression with the subquery.booleanisClassTypeExpression()INTERNAL:booleanisCompoundExpression()INTERNAL:booleanisConstantExpression()INTERNAL:booleanisDataExpression()INTERNAL:ExpressionisEmpty(java.lang.String attributeName)PUBLIC: A logical expression for the collectionattributeNamebeing empty.booleanisExpressionBuilder()INTERNAL:booleanisFieldExpression()INTERNAL:ExpressionisFragment()PUBLIC: XMLType Function - evaluates to 0 if the xml is a well formed document and 1 if the document is a fragmentbooleanisFunctionExpression()INTERNAL:booleanisLiteralExpression()INTERNAL:booleanisLogicalExpression()INTERNAL:booleanisMapEntryExpression()INTERNAL:ExpressionisNull()PUBLIC: Compare to null.booleanisObjectExpression()INTERNAL:booleanisParameterExpression()INTERNAL:booleanisQueryKeyExpression()INTERNAL:booleanisRelationExpression()INTERNAL:booleanisSubSelectExpression()INTERNAL:booleanisTableExpression()INTERNAL:booleanisTreatExpression()INTERNAL:booleanisValueExpression()INTERNAL: Subclasses implement (isParameterExpression() || isConstantExpression())voiditerateOn(org.eclipse.persistence.internal.expressions.ExpressionIterator iterator)INTERNAL: For iterating using an inner classExpressionjoin(Expression target, Expression onClause)ADVANCED: Defines a join between the two objects based on the specified ON clause.ExpressionlastDay()PUBLIC: Function, returns the date with the last date in the months of this source date.ExpressionleftJoin(Expression target, Expression onClause)ADVANCED: Defines an outer join between the two objects based on the specified ON clause.ExpressionleftPad(int size, java.lang.Object substring)PUBLIC: Function, returns the string padded with the substring to the size.ExpressionleftPad(java.lang.Object size, java.lang.Object substring)PUBLIC: Function, returns the string padded with the substring to the size.ExpressionleftTrim()PUBLIC: Function, returns the string left trimmed for white space.ExpressionleftTrim(java.lang.Object substring)PUBLIC: Function, returns the string with the substring trimed from the left.Expressionlength()PUBLIC: Function, returns the size of the string.ExpressionlessThan(boolean theBoolean)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(byte theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(char theChar)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(double theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(float theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(int theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(long theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(short theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receivers value is less than the other value.ExpressionlessThan(Expression theValue)ExpressionlessThanEqual(boolean theBoolean)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(byte theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(char theChar)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(double theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(float theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(int theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(long theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(short theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.ExpressionlessThanEqual(Expression theValue)PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value.Expressionlike(java.lang.String value)PUBLIC: Return an expression that compares if the receivers value is like other value.Expressionlike(java.lang.String value, java.lang.String escapeSequence)PUBLIC: Return an expression that compares if the receivers value is like other value.Expressionlike(Expression argument)PUBLIC: Return an expression that compares if the receivers value is like other value.Expressionlike(Expression value, Expression escapeSequence)PUBLIC: Return an expression that compares if the receivers value is like other value.ExpressionlikeIgnoreCase(java.lang.String theValue)PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case.ExpressionlikeIgnoreCase(Expression theValue)PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case.Expressionliteral(java.lang.String literal)ADVANCED: Return an expression on the literal.Expressionlocate(java.lang.Object str)PUBLIC: Function, returns the position ofstrinthisExpressionlocate(java.lang.Object str, java.lang.Object fromIndex)PUBLIC: Function, returns the position ofstrinthis, starting the search atfromIndex.Expressionlocate(java.lang.String str, int fromIndex)PUBLIC: Function, returns the position ofstrinthis, starting the search atfromIndex.ExpressionmapEntry()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()ExpressionmapKey()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()Expressionmaximum()PUBLIC: This represents the aggregate function Maximum.Expressionminimum()PUBLIC: This represents the aggregate function Minimum.ExpressionmonthsBetween(java.lang.Object otherDate)PUBLIC: Function, returns the decimal number of months between the two dates.ExpressionnewTime(java.lang.String timeZoneFrom, java.lang.String timeZoneTo)PUBLIC: funcation return a date converted to a new timezone.ExpressionnextDay(java.lang.Object dayName)PUBLIC: Function, returns the date with the next day from the source date as the day name given.ExpressionnoneOf(java.lang.String attributeName, Expression criteria)PUBLIC: Returns an expression equivalent to none ofattributeNameholding true forcriteria.Expressionnormalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)INTERNAL: Normalize into a structure that is printable.Expressionnot()PUBLIC: Return an expression that is the boolean logical negation of the expression.ExpressionnotBetween(byte leftValue, byte rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(char leftChar, char rightChar)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(double leftValue, double rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(float leftValue, float rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(int leftValue, int rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(long leftValue, long rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(short leftValue, short rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(java.lang.Object leftValue, java.lang.Object rightValue)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotBetween(Expression leftExpression, Expression rightExpression)PUBLIC: Return an expression that compares if the receivers value is not between two other values.ExpressionnotEmpty(java.lang.String attributeName)PUBLIC: A logical expression for the collectionattributeNamenot being empty.ExpressionnotEqual(boolean theBoolean)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(byte theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(char theChar)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(double theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(float theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(int theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(long theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(short theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(java.lang.Object theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotEqual(Expression theValue)PUBLIC: Return an expression that compares if the receivers value is not equal to the other value.ExpressionnotExists(ReportQuery subQuery)PUBLIC: Return a sub query expression.ExpressionnotIn(boolean[] theBooleans)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(byte[] theBytes)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(char[] theChars)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(double[] theDoubles)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(float[] theFloats)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(int[] theInts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(long[] theLongs)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(short[] theShorts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(java.lang.Object[] theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(java.util.Collection theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.ExpressionnotIn(Expression arguments)ExpressionnotIn(ReportQuery subQuery)ExpressionnotLike(java.lang.String aString)PUBLIC: Return an expression that compares if the receivers value is not like the other value.ExpressionnotLike(java.lang.String value, java.lang.String escapeSequence)PUBLIC: Return an expression that compares if the receivers value is not like the other value.ExpressionnotLike(Expression arguments)PUBLIC: Return an expression that compares if the receivers value is not like the other value.ExpressionnotLike(Expression value, Expression escapeSequence)PUBLIC: Return an expression that compares if the receivers value is not like the other value.ExpressionnotNull()PUBLIC: Return an expression representing a comparison to nullExpressionnullIf(java.lang.Object object)PUBLIC: Function Test if arguments are equal, returning null if they are and the value of the first expression otherwise.ExpressionnullsFirst()PUBLIC: This can only be used within an ordering expression.ExpressionnullsLast()PUBLIC: This can only be used within an ordering expression.Expressionoperator(java.lang.String name, java.util.List arguments)ADVANCED: This can be used for accessing user defined operators that have arguments.Expressionor(Expression theExpression)PUBLIC: Return an expression that is the boolean logical combination of both expressions.ExpressionperformOperator(ExpressionOperator anOperator, java.util.List args)INTERNAL:protected voidpostCopyIn(java.util.Map alreadyDone)ExpressionpostfixSQL(java.lang.String sqlString)ADVANCED: Inserts the SQL as is directly into the expression.ExpressionprefixSQL(java.lang.String sqlString)ADVANCED: Insert the SQL as is directly into the expression.voidprintJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)INTERNAL: Print java for project class generationabstract voidprintSQL(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer)INTERNAL: Print SQLabstract ExpressionrebuildOn(Expression newBase)INTERNAL: This expression is built on a different base than the one we want.Expressionref()ADVANCED: For Object-relational support.Expressionregexp(java.lang.String regexp)PUBLIC: Return an expression that compares if the receivers value matches the regular expression.Expressionregexp(Expression regexp)PUBLIC: Return an expression that compares if the receivers value matches the regular expression.protected ExpressionregisterIn(java.util.Map alreadyDone)Expressionreplace(java.lang.Object stringToReplace, java.lang.Object stringToReplaceWith)PUBLIC: Function, returns the string with occurances of the first substring replaced with the second substring.Expressionreplicate(int constant)PUBLIC: return the result of this query repeated a given number of times.Expressionreplicate(java.lang.Object theValue)PUBLIC: return the result of this query repeated a given number of times.protected voidresetCache()Reset cached information here so that we can be sure we're accurate.abstract voidresetPlaceHolderBuilder(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.Expressionreverse()PUBLIC: Function return the reverse of the query result.Expressionright(int characters)PUBLIC: Function return a given number of characters starting at the right of a string.Expressionright(java.lang.Object characters)PUBLIC: Function return a given number of characters starting at the right of a string.ExpressionrightPad(int size, java.lang.Object substring)PUBLIC: Function, returns the string padded with the substring to the size.ExpressionrightPad(java.lang.Object size, java.lang.Object substring)PUBLIC: Function, returns the string padded with the substring to the size.ExpressionrightTrim()PUBLIC: Function, returns the string right trimmed for white space.ExpressionrightTrim(java.lang.Object substring)PUBLIC: Function, returns the string with the substring trimed from the right.ExpressionroundDate(java.lang.Object yearOrMonthOrDayRoundToken)PUBLIC: Function, returns the date rounded to the year, month or day.booleanselectIfOrderedBy()PUBLIC: Return whether this expression should be included in the SELECT clause if it is used in an ORDER BY clausevoidsetLocalBase(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.voidsetSelectIfOrderedBy(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.ExpressionshallowClone()INTERNAL:Expressionsize(java.lang.Class returnType)PUBLIC: A logical expression for the size of collection expression.Expressionsize(java.lang.String attributeName)PUBLIC: A logical expression for the size of collectionattributeName.Expressionsome(boolean[] theBooleans)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(byte[] theBytes)PUBLIC: Return an expression that is used with a comparison expression.Expressionsome(char[] theChars)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(double[] theDoubles)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(float[] theFloats)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(int[] theInts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(long[] theLongs)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(short[] theShorts)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(java.lang.Object[] theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(java.util.List theObjects)PUBLIC: Return an expression that checks if the receivers value is contained in the collection.Expressionsome(java.util.Vector theObjects)Deprecated.since 2.4 replaced by some(List)Expressionsome(Expression arguments)Expressionsome(ReportQuery subQuery)Expressionsql(java.lang.String sql, java.util.List arguments)ADVANCED: Parse the SQL for parameter and return a custom function expression using a custom operator that will print itself as the SQL.ExpressionstandardDeviation()PUBLIC: This represents the aggregate function StandardDeviation.ExpressionsubQuery(ReportQuery subQuery)PUBLIC: Return a sub query expression.Expressionsubstring(int startPosition)PUBLIC: Function, returns the substring from the source string.Expressionsubstring(int startPosition, int size)PUBLIC: Function, returns the substring from the source string.Expressionsubstring(java.lang.Object startPosition)PUBLIC: Function, returns the substring from the source string.Expressionsubstring(java.lang.Object startPosition, java.lang.Object size)PUBLIC: Function, returns the substring from the source string.Expressionsum()PUBLIC: This represents the aggregate function Sum.ExpressiontoChar()PUBLIC: Return an expression that represents the receiver value converted to a character string.ExpressiontoChar(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.ExpressiontoCharacter()PUBLIC: Function, returns the single character string with the ascii or character set value.ExpressiontoDate()PUBLIC: Function, returns date from the string using the default format.ExpressiontoLowerCase()PUBLIC: Return an expression that represents the receiver value converted to lower case.ExpressiontoNumber()PUBLIC: Function, returns the number converted from the string.java.lang.StringtoString()PUBLIC: Print a debug form of the expression tree.voidtoString(java.io.BufferedWriter writer, int indent)INTERNAL: Print a debug form of the expression tree.ExpressiontoUpperCase()PUBLIC: Return an expression that represents the receiver value converted to upper case.ExpressiontoUppercaseCasedWords()PUBLIC: Function, returns the string with the first letter of each word capitalized.Expressiontranslate(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.Expressiontreat(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") downcast uses Expression.type() internally to guarantee the results are of the specified class.Expressiontrim()PUBLIC: Function, returns the string trimmed for white space.Expressiontrim(java.lang.Object substring)PUBLIC: Function, returns the string right and left trimmed for the substring.ExpressiontruncateDate(java.lang.String datePart)PUBLIC: return the date truncated to the indicated datePart.Expressiontwist(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.ExpressiontwistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression.Expressiontype()PUBLIC: Return an expression that wraps the inheritance type field in an expression.Expressionunion(Expression arguments)PUBLIC: Return a union expression with the subquery.Expressionunion(ReportQuery query)PUBLIC: Return a union expression with the subquery.ExpressionunionAll(Expression arguments)PUBLIC: Return a union all expression with the subquery.ExpressionunionAll(ReportQuery query)PUBLIC: Return a union all expression with the subquery.voidvalidateNode()INTERNAL: Do any required validation for this node.Expressionvalue()PUBLIC: Function, this represents the value function, used in nestedtableExpressionvalue(boolean constant)PUBLIC: Return an expression on the constant.Expressionvalue(byte constant)PUBLIC: Return an expression on the constant.Expressionvalue(char constant)PUBLIC: Return an expression on the constant.Expressionvalue(double constant)PUBLIC: Return an expression on the constant.Expressionvalue(float constant)PUBLIC: Return an expression on the constant.Expressionvalue(int constant)PUBLIC: Return an expression on the constant.Expressionvalue(long constant)PUBLIC: Return an expression on the constant.Expressionvalue(short constant)PUBLIC: Return an expression on the constant.Expressionvalue(java.lang.Object constant)PUBLIC: Return an expression on the constant.java.lang.ObjectvalueFromObject(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.ObjectvalueFromObject(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.Expressionvariance()PUBLIC: Function, this represents the aggregate function Variance.protected voidwriteAlias(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.voidwriteDescriptionOn(java.io.BufferedWriter writer)INTERNAL: Used to print a debug form of the expression tree.protected voidwriteField(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.voidwriteFields(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, java.util.Vector newFields, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)INTERNAL: called from SQLSelectStatement.writeFieldsFromExpression(...)voidwriteSubexpressionsTo(java.io.BufferedWriter writer, int indent)INTERNAL: Used in SQL printing.
-
-
-
Field Detail
-
lastTable
protected transient org.eclipse.persistence.internal.helper.DatabaseTable lastTable
Temporary values for table aliasing
-
currentAlias
protected transient org.eclipse.persistence.internal.helper.DatabaseTable currentAlias
-
selectIfOrderedBy
protected boolean selectIfOrderedBy
-
hashCode
protected int hashCode
PERF: Cache the hashCode.
-
shouldUseUpperCaseForIgnoreCase
public static boolean shouldUseUpperCaseForIgnoreCase
Use the upper() function for case insensitive expression operations (default). Seting this flag to false will use the lower() function instead.
-
-
Method Detail
-
addDate
public Expression addDate(java.lang.String datePart, int numberToAdd)
PUBLIC: Function, return an expression that adds to a date based on the specified datePart. This is equivalent to the Sybase DATEADD function.Example:
EclipseLink: employee.get("date").addDate("year", 2) Java: NA SQL: DATEADD(date, 2, year)
-
addDate
public 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. This is equivalent to the Sybase DATEADD function.Example:
EclipseLink: employee.get("date").addDate("year", 2) Java: NA SQL: DATEADD(date, 2, year)
-
addMonths
public Expression addMonths(int months)
PUBLIC: Function, to add months to a date.
-
addMonths
public Expression addMonths(java.lang.Object months)
PUBLIC: Function, to add months to a date.
-
aliasForTable
public org.eclipse.persistence.internal.helper.DatabaseTable aliasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL: Find the alias for a given table
-
allOf
public Expression allOf(java.lang.String attributeName, Expression criteria)
PUBLIC: Returns an expression equivalent to all ofattributeNameholding true forcriteria.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
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").notEqual("613"))); Expression exp = employee.notExists(subQuery);Note if employee has no phone numbers allOf ~ noneOf.
- Parameters:
criteria- must have its own builder, as it will become the separate selection criteria of a subQuery.- Returns:
- a notExists subQuery expression
-
and
public Expression and(Expression theExpression)
PUBLIC: Return an expression that is the boolean logical combination of both expressions. This is equivalent to the SQL "AND" operator and the Java "&&" operator.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'
-
anyOf
public Expression anyOf(java.lang.String attributeName)
PUBLIC: Return an expression representing traversal of a 1:many or many:many relationship. This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria.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')
-
anyOf
public Expression anyOf(java.lang.String attributeName, boolean shouldJoinBeIndependent)
ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship. This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria.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') - Parameters:
shouldJoinBeIndependent- indicates whether a new expression should be created.
-
anyOfAllowingNone
public Expression anyOfAllowingNone(java.lang.String attributeName)
ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship. This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria. This version of the anyOf operation performs an outer join. Outer joins allow the join to performed even if the target of the relationship is empty. NOTE: outer joins are not supported on all database and have differing semantics.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')
-
anyOfAllowingNone
public Expression anyOfAllowingNone(java.lang.String attributeName, boolean shouldJoinBeIndependent)
ADVANCED: Return an expression representing traversal of a 1:many or many:many relationship. This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria. This version of the anyOf operation performs an outer join. Outer joins allow the join to performed even if the target of the relationship is empty. NOTE: outer joins are not supported on all database and have differing semantics.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') - Parameters:
shouldJoinBeIndependent- indicates whether a new expression should be created.
-
as
@Deprecated public Expression as(java.lang.Class castClass)
Deprecated.replaced bytreat(Class)ADVANCED: Return an expression that allows you to treat its base as if it were a subclass of the class returned by the base.
-
as
public Expression as(java.lang.String alias)
ADVANCED: Assign an alias to the expression in the select clause.
-
treat
public Expression treat(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") downcast uses Expression.type() internally to guarantee the results are of the specified class.Example:
EclipseLink: employee.get("project").treat(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 AND PROJ.TYPE = "L"
-
ascending
public Expression ascending()
PUBLIC: This can only be used within an ordering expression. It will order the result ascending. Example:readAllQuery.addOrderBy(expBuilder.get("address").get("city").ascending())
-
nullsFirst
public Expression nullsFirst()
PUBLIC: This can only be used within an ordering expression. Null results will be ordered first. Example:readAllQuery.addOrderBy(expBuilder.get("address").get("city").ascending().nullsFirst())
-
nullsLast
public Expression nullsLast()
PUBLIC: This can only be used within an ordering expression. Null results will be ordered last. Example:readAllQuery.addOrderBy(expBuilder.get("address").get("city").ascending().nullsLast())
-
asciiValue
public Expression asciiValue()
PUBLIC: Function, returns the single character strings ascii value.
-
asOf
public Expression asOf(AsOfClause pastTime)
Sets all tables represented by this expression to be queried as of a past time.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:
- query objects as of one time that met some condition at another time.
- query objects that changed a certain way over a certain interval (querying for change).
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:
- employee.asOf(pastTime).anyOf("projects"): projects as of past time.
- expressionBuilder.asOf(pastTime): entire expression as of past time.
- employee.asOf(pastTime).anyOf("projects").asOf(null): projects as of current time.
- employee.anyOf("projects").asOf(pastTime): projects only as of past time.
Watch out for x.asOf(oneTime).get("y").asOf(anotherTime).
- emp.anyOf("phoneNumbers").asOf(yesterday) = emp.asOf(yesterday).anyOf("phoneNumbers") but:
- emp.get("address").asOf(yesterday) != emp.asOf(yesterday).get("address").
- Parameters:
pastTime- A read only data object used to represent a past time.- Returns:
this- See Also:
AsOfClause,hasAsOfClause(),Session.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause),ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause)- Since:
- OracleAS EclipseLink 10g (10.0.3)
-
assignAlias
protected void assignAlias(java.lang.String name, org.eclipse.persistence.internal.helper.DatabaseTable tableOrExpression)INTERNAL: Alias a particular table within this node
-
assignTableAliasesStartingAt
public int assignTableAliasesStartingAt(int initialValue)
INTERNAL: Assign aliases to any tables which I own. Start with t(initialValue), and return the new value of the counter , i.e. if initialValue is one and I have tables ADDRESS and EMPLOYEE I will assign them t1 and t2 respectively, and return 3.
-
average
public Expression average()
PUBLIC: Function, This represents the aggregate function Average. Can be used only within Report Queries.
-
between
public Expression between(byte leftValue, byte rightValue)
PUBLIC: Function, between two bytes
-
between
public Expression between(char leftChar, char rightChar)
PUBLIC: Function, between two chars
-
between
public Expression between(double leftValue, double rightValue)
PUBLIC: Function, between two doubles
-
between
public Expression between(float leftValue, float rightValue)
PUBLIC: Function, between two floats
-
between
public Expression between(int leftValue, int rightValue)
PUBLIC: Function, between two ints
-
between
public Expression between(long leftValue, long rightValue)
PUBLIC: Function, between two longs
-
between
public 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. This means the receiver's value is greater than or equal to the leftValue argument and less than or equal to the rightValue argument.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
-
between
public Expression between(Expression leftExpression, Expression rightExpression)
-
between
public Expression between(short leftValue, short rightValue)
PUBLIC: Function, between two shorts
-
caseStatement
public 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. The equivalent of the Oracle CASE functionExample:
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"- Parameters:
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 match
-
caseStatement
public org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression caseStatement()
INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form:
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"- See Also:
ArgumentListFunctionExpression
-
caseConditionStatement
public 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. The equivalent of the SQL CASE functionExample:
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"- Parameters:
caseConditions- 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 match
-
caseConditionStatement
public org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression caseConditionStatement()
INTERNAL: Creates an ArgumentListFunctionExpression that is capable of creating a case statement of the form:
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"- See Also:
ArgumentListFunctionExpression
-
nullIf
public 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.Example:
EclipseLink: builder.get("name").nullIf( "Bobby") Java: NA SQL: NULLIF(name, "Bobby")- Parameters:
object- java.lang.Object the value/expression that will be compared to the base expression
-
coalesce
public 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 functionExample:
List list = new ArrayList(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)- Parameters:
expressions- java.util.Collection A Collection containing the items to check if null
-
coalesce
public org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression coalesce()
-
clone
public java.lang.Object clone()
INTERNAL: Clone the expression maintaining clone identity in the inter-connected expression graph.- Overrides:
clonein classjava.lang.Object
-
cloneUsing
public Expression cloneUsing(Expression newBase)
INTERNAL: This expression is built on a different base than the one we want. Rebuild it and return the root of the new tree. This method will rebuildOn the receiver even it is a parallel select or a sub select: it will not replace every base with newBase. Also it will rebuild using anyOf as appropriate not get.- See Also:
ForeignReferenceMapping.batchedValueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord, org.eclipse.persistence.queries.ObjectLevelReadQuery, org.eclipse.persistence.internal.identitymaps.CacheKey),rebuildOn(Expression)- Related Bugs:
- 2637484 INVALID QUERY KEY EXCEPTION THROWN USING BATCH READS AND PARALLEL EXPRESSIONS, 2612567 CR4298- NULLPOINTEREXCEPTION WHEN USING SUBQUERY AND BATCH READING IN 4.6, 2612140 CR2973- BATCHATTRIBUTE QUERIES WILL FAIL WHEN THE INITIAL QUERY HAS A SUBQUERY, 2720149 INVALID SQL WHEN USING BATCH READS AND MULTIPLE ANYOFS
-
concat
public Expression concat(java.lang.Object left)
PUBLIC: Function, returns the concatenation of the two string values.
-
containsAllKeyWords
public Expression containsAllKeyWords(java.lang.String spaceSeparatedKeyWords)
PUBLIC: Return an expression that performs a key word search.Example:
EclipseLink: project.get("description").containsAllKeyWords("EclipseLink rdbms java")
-
containsAnyKeyWords
public Expression containsAnyKeyWords(java.lang.String spaceSeparatedKeyWords)
PUBLIC: Return an expression that performs a key word search.Example:
EclipseLink: project.get("description").containsAllKeyWords("EclipseLink rdbms java")
-
containsSubstring
public Expression containsSubstring(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value contains the substring.Example:
EclipseLink: employee.get("firstName").containsSubstring("Bob") Java: employee.getFirstName().indexOf("Bob") != -1 SQL: F_NAME LIKE '%BOB%'
-
containsSubstring
public Expression containsSubstring(Expression expression)
PUBLIC: Return an expression that compares if the receivers value contains the substring.Example:
EclipseLink: employee.get("firstName").containsSubstring("Bob") Java: employee.getFirstName().indexOf("Bob") != -1 SQL: F_NAME LIKE '%BOB%'
-
containsSubstringIgnoringCase
public Expression containsSubstringIgnoringCase(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case.Example:
EclipseLink: employee.get("firstName").containsSubstringIgnoringCase("Bob") Java: employee.getFirstName().toUpperCase().indexOf("BOB") != -1 SQL: UPPER(F_NAME) LIKE '%BOB%'
-
containsSubstringIgnoringCase
public Expression containsSubstringIgnoringCase(Expression expression)
PUBLIC: Return an expression that compares if the receivers value contains the substring, ignoring case.Example:
EclipseLink: employee.get("firstName").containsSubstringIgnoringCase("Bob") Java: employee.getFirstName().toUpperCase().indexOf("BOB") != -1 SQL: UPPER(F_NAME) LIKE '%BOB%'
-
convertNodeToUseOuterJoin
protected void convertNodeToUseOuterJoin()
-
convertToUseOuterJoin
public Expression convertToUseOuterJoin()
INTERNAL: Modify this expression to use outer joins wherever there are equality operations between two field nodes.
-
copiedVersionFrom
public Expression copiedVersionFrom(java.util.Map alreadyDone)
INTERNAL:
-
count
public Expression count()
PUBLIC: This represents the aggregate function Average. Can be used only within Report Queries.
-
create
public Expression create(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)
INTERNAL:
-
createWithBaseLast
public Expression createWithBaseLast(Expression base, java.lang.Object singleArgument, ExpressionOperator anOperator)
INTERNAL:
-
create
public Expression create(Expression base, java.util.List arguments, ExpressionOperator anOperator)
INTERNAL:
-
currentTimeStamp
public Expression currentTimeStamp()
PUBLIC: This gives access to the current timestamp on the database through expression. Please note, this method is added for consistency and returns the same result as currentDate.
-
currentDate
public Expression currentDate()
PUBLIC: This gives access to the current date on the database through expression.
-
currentDateDate
public Expression currentDateDate()
PUBLIC: This gives access to the current date only on the database through expression. Note the difference between currentDate() and this method. This method does not return the time portion of current date where as currentDate() does.
-
currentTime
public Expression currentTime()
PUBLIC: This gives access to the current time only on the database through expression. Note the difference between currentDate() and this method. This method does not return the date portion where as currentDate() does.
-
dateDifference
public 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.) and same part of the given date. The equivalent of the Sybase function DateDiffExample:
EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) Java: NA SQL: DATEADD(date, 2, GETDATE)
-
dateDifference
public 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.) and same part of the given date. The equivalent of the Sybase function DateDiffExample:
EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) Java: NA SQL: DATEADD(date, 2, GETDATE)
-
dateName
public Expression dateName(java.lang.String datePart)
PUBLIC: return a string that represents the given part of a date. The equivalent of the Sybase DATENAME functionExample:
EclipseLink: employee.get("date").dateName("year") Java: new String(date.getYear()) SQL: DATENAME(date, year)
-
datePart
public Expression datePart(java.lang.String datePart)
PUBLIC: Function return an integer which represents the requested part of the date. Equivalent of the Sybase function DATEPARTExample:
EclipseLink: employee.get("date").datePart("year") Java: date.getYear() SQL: DATEPART(date, year)
-
dateToString
public Expression dateToString()
PUBLIC: Function, returns the date converted to the string value in the default database format.
-
decode
public 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. The equivalent of the Oracle DECODE function. Note: This will only work on databases that support Decode with the syntax below.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")- Parameters:
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 match
-
descending
public Expression descending()
PUBLIC: This can only be used within an ordering expression. It will order the result descending.Example:
readAllQuery.addOrderBy(expBuilder.get("address").get("city").descending())
-
descriptionOfNodeType
public java.lang.String descriptionOfNodeType()
INTERNAL: Used in debug printing of this node.
-
difference
public Expression difference(java.lang.String expression)
PUBLIC: Function return a value which indicates how much difference there is between two expressions. Equivalent of the Sybase DIFFERENCE functionExample:
EclipseLink: employee.get("name").difference("Frank") SQL: DIFFERENCE(name, 'Frank')
-
distinct
public Expression distinct()
PUBLIC: Function, This represents the distinct option inside an aggregate function. Can be used only within Report Queries.
-
doesConform
public boolean doesConform(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy) throws QueryExceptionINTERNAL: Check if the object conforms to the expression in memory. This is used for in-memory querying. By default throw an exception as all valid root expressions must override. If the expression in not able to determine if the object conform throw a not supported exception.- Throws:
QueryException
-
doesConform
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 QueryExceptionINTERNAL: New parameter added to doesConform for feature 2612601- Parameters:
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.- Throws:
QueryException
-
equals
public boolean equals(java.lang.Object expression)
INTERNAL: Return if the expression is equal to the other. This is used to allow dynamic expression's SQL to be cached. Two expressions should be considered equal if they have the same "parameterized" SQL. This must be over written by each subclass.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
INTERNAL: Return a consistent hash-code for the expression. This is used to allow dynamic expression's SQL to be cached. Two expressions should have the same hashCode if they have the same "parameterized" SQL. This should be over written by each subclass to provide a consistent value.- Overrides:
hashCodein classjava.lang.Object
-
computeHashCode
public int computeHashCode()
INTERNAL: Compute a consistent hash-code for the expression. This is used to allow dynamic expression's SQL to be cached. Two expressions should have the same hashCode if they have the same "parameterized" SQL. This should be over written by each subclass to provide a consistent value.
-
equal
public Expression equal(byte theValue)
-
equal
public Expression equal(char theChar)
-
equal
public Expression equal(double theValue)
-
equal
public Expression equal(float theValue)
-
equal
public Expression equal(int theValue)
-
equal
public Expression equal(long theValue)
-
equal
public Expression equal(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receiver's value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.Example:
EclipseLink: employee.get("firstName").equal("Bob") Java: employee.getFirstName().equals("Bob") SQL: F_NAME = 'Bob'
-
equal
public Expression equal(Expression theValue)
Returns an expression that compares if the receiver's value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.Since OracleAS EclipseLink 10g (9.0.4) if
thisis anExpressionBuilderandtheValueis 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- See Also:
equal(Object)
-
equal
public Expression equal(short theValue)
-
equal
public Expression equal(boolean theBoolean)
-
equalOuterJoin
public Expression equalOuterJoin(java.lang.Object theValue)
INTERNAL: Return an expression representing an outer join comparison
-
equalOuterJoin
public Expression equalOuterJoin(Expression theValue)
INTERNAL: Return an expression representing an outer join comparison
-
equalsIgnoreCase
public 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. This is equivalent to the Java "equalsIgnoreCase" method.Example:
EclipseLink: employee.get("firstName").equalsIgnoreCase("Bob") Java: employee.getFirstName().equalsIgnoreCase("Bob") SQL: UPPER(F_NAME) = 'BOB'
-
equalsIgnoreCase
public Expression equalsIgnoreCase(Expression theValue)
PUBLIC: Return an expression that compares if the receiver's value is equal to the other value, ignoring case. This is equivalent to the Java "equalsIgnoreCase" method.Example:
EclipseLink: employee.get("firstName").equalsIgnoreCase("Bob") Java: employee.getFirstName().equalsIgnoreCase("Bob") SQL: UPPER(F_NAME) = 'BOB'
-
exists
public Expression exists(ReportQuery subQuery)
PUBLIC: Return a sub query expression. A sub query using a report query to define a subselect within another queries expression or select's where clause. The sub query (the report query) will use its own expression builder be can reference expressions from the base expression builder.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);
-
extractPrimaryKeyValues
public 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. Ensure that the query is querying the exact primary key. Return false if not on the primary key.
-
extractValues
public boolean extractValues(boolean primaryKeyOnly, 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. Ensure that the query is querying the exact primary key. Return false if not on the primary key.
-
extractFields
public boolean extractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> searchFields, java.util.Set<org.eclipse.persistence.internal.helper.DatabaseField> foundFields)INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.
-
from
public static Expression from(java.lang.Object value, Expression base)
INTERNAL: Create an expression node.
-
fromConstant
public static Expression fromConstant(java.lang.Object value, Expression base)
INTERNAL: Create an expression node.
-
fromLiteral
public static Expression fromLiteral(java.lang.String value, Expression base)
INTERNAL: Create an expression node.
-
get
public Expression get(java.lang.String attributeName)
PUBLIC: Return an expression that wraps the attribute or query key name. This method is used to construct user-defined queries containing joins.Example:
builder.get("address").get("city").equal("Ottawa");
-
get
public Expression get(java.lang.String attributeName, boolean forceInnerJoin)
PUBLIC: Return an expression that wraps the attribute or query key name. This method is used to construct user-defined queries containing joins.Example:
builder.get("address", false).get("city").equal("Ottawa");- Parameters:
forceInnerJoin- - allows the get to not force an inner-join (if getAllowingNull was used elsewhere).
-
getAllowingNull
public Expression getAllowingNull(java.lang.String attributeName)
ADVANCED: Return an expression that wraps the attribute or query key name. This is only applicable to 1:1 relationships, and allows the target of the relationship to be null if there is no corresponding relationship in the database. Implemented via an outer join in the database.Example:
builder.getAllowingNull("address").get("city").equal("Ottawa");
-
getAsOfClause
public AsOfClause getAsOfClause()
Answers the past time the expression is explicitly as of.- Returns:
- An immutable object representation of the past time.
nullif no clause set,AsOfClause.NO_CLAUSEif clause explicitly set tonull. - See Also:
asOf(org.eclipse.persistence.history.AsOfClause),hasAsOfClause()
-
getAsOfClauseRecursively
public AsOfClause getAsOfClauseRecursively()
INTERNAL: For Flashback: If this expression is not already as of some timestamp gets the clause from the base expression. Allows a clause to be set only on the builder and then propogated during normalize.
-
getBuilder
public 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)
-
getClonedField
public org.eclipse.persistence.internal.helper.DatabaseField getClonedField()
INTERNAL: If there are any fields associated with this expression, return them
-
getField
public Expression getField(java.lang.String fieldName)
ADVANCED: Return an expression representing a field in a data-level query. This is used internally in EclipseLink, or to construct queries involving fields and/or tables that are not mapped.Example:
builder.getField("ADDR_ID").greaterThan(100); builder.getTable("PROJ_EMP").getField("TYPE").equal("S");
-
getField
public Expression getField(org.eclipse.persistence.internal.helper.DatabaseField field)
ADVANCED: Return an expression representing a field in a data-level query. This is used internally in EclipseLink, or to construct queries involving fields and/or tables that are not mapped.Example:
builder.getField(aField).greaterThan(100);
-
getFields
public java.util.Vector getFields()
INTERNAL:
-
getSelectionFields
public java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getSelectionFields()
INTERNAL:
-
getSelectionFields
public java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getSelectionFields(ReadQuery query)
-
getFieldValue
public 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
-
join
public Expression join(Expression target, Expression onClause)
ADVANCED: Defines a join between the two objects based on the specified ON clause. This can be used to define a join condition on two unrelated objects, or to qualify a relationship join with additional criteria.Example:
Expression address = employee.getAllowingNull("address"); employee.join(address, address.get("city").equal("Ottawa")); query.addNonFetchJoin(address);
-
leftJoin
public Expression leftJoin(Expression target, Expression onClause)
ADVANCED: Defines an outer join between the two objects based on the specified ON clause. This can be used to define a join condition on two unrelated objects, or to qualify a relationship join with additional criteria.Example:
Expression address = employee.getAllowingNull("address"); employee.leftJoin(address, address.get("city").equal("Ottawa")); query.addNonFetchJoin(address);
-
getFunction
public Expression getFunction(int selector)
ADVANCED: This can be used for accessing user defined functions. The operator must be defined in ExpressionOperator to be able to reference it.
-
getFunction
public Expression getFunction(int selector, java.util.List arguments)
ADVANCED: This can be used for accessing user defined functions that have arguments. The operator must be defined in ExpressionOperator to be able to reference it.
-
operator
public Expression operator(java.lang.String name, java.util.List arguments)
ADVANCED: This can be used for accessing user defined operators that have arguments. The operator must be defined in ExpressionOperator to be able to reference it.
-
getFunction
@Deprecated public Expression getFunction(int selector, java.util.Vector arguments)
Deprecated.ADVANCED: This can be used for accessing user defined functions that have arguments. The operator must be defined in ExpressionOperator to be able to reference it.
-
getFunction
public Expression getFunction(java.lang.String functionName)
ADVANCED: Return a user defined function accepting the argument. The function is assumed to be a normal prefix function and will print like, UPPER(base).Example:
builder.get("firstName").getFunction("UPPER");
-
getFunction
public Expression getFunction(java.lang.String functionName, java.lang.Object argument)
ADVANCED: Return a user defined function accepting the argument. The function is assumed to be a normal prefix function and will print like, CONCAT(base, argument).
-
getFunctionWithArguments
@Deprecated public Expression getFunctionWithArguments(java.lang.String functionName, java.util.Vector arguments)
Deprecated.ADVANCED: Return a user defined function accepting all of the arguments. The function is assumed to be a normal prefix function like, CONCAT(base, value1, value2, value3, ...).
-
getFunctionWithArguments
public Expression getFunctionWithArguments(java.lang.String functionName, java.util.List arguments)
ADVANCED: Return a user defined function accepting all of the arguments. The function is assumed to be a normal prefix function like, CONCAT(base, value1, value2, value3, ...).
-
sql
public Expression sql(java.lang.String sql, java.util.List arguments)
ADVANCED: Parse the SQL for parameter and return a custom function expression using a custom operator that will print itself as the SQL. Arguments are passed using '?', and must match the number of arguments.
-
type
public Expression type()
PUBLIC: Return an expression that wraps the inheritance type field in an expression.Example:
builder.getClassForInheritance().equal(SmallProject.class); builder.anyOf("projects").getClassForInheritance().equal(builder.getParameter("projectClass"));
-
getName
public java.lang.String getName()
INTERNAL:
-
getOperator
public ExpressionOperator getOperator()
INTERNAL: Most expression have operators, so this is just a convenience method.
-
getOperator
public static ExpressionOperator getOperator(int selector)
INTERNAL: Create a new expression tree with the named operator. Part of the implementation of user-level "get"
-
getOwnedTables
public java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable> getOwnedTables()
INTERNAL: Return the tables that this node owns for purposes of table aliasing.
-
getParameter
public Expression getParameter(java.lang.String parameterName, java.lang.Object type)
INTERNAL: Return an expression representing a parameter with the given name and type
-
getParameter
public Expression getParameter(java.lang.String parameterName)
ADVANCED: Return an expression representing a parameter with the given name.
-
getParameter
public Expression getParameter(org.eclipse.persistence.internal.helper.DatabaseField field)
ADVANCED: Return an expression representing a parameter with the given name.
-
getProperty
public Expression getProperty(org.eclipse.persistence.internal.helper.DatabaseField field)
ADVANCED: Return an expression representing a property with the given name.
-
getSession
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
INTERNAL:
-
getTable
public Expression getTable(java.lang.String tableName)
ADVANCED: Return an expression representing a table in a data-level query. This is used internally in EclipseLink, or to construct queries involving fields and/or tables that are not mapped.Example:
builder.getTable("PROJ_EMP").getField("TYPE").equal("S");
-
getTable
public Expression getTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
ADVANCED: Return an expression representing a table in a data-level query. This is used internally in EclipseLink, or to construct queries involving fields and/or tables that are not mapped.Example:
builder.getTable(linkTable).getField("TYPE").equal("S");
-
getAlias
public Expression getAlias(Expression subSelect)
ADVANCED: Return an expression representing a sub-select in the from clause.Example:
builder.getAlias(builder.subQuery(reportQuery)).get("type").equal("S");
-
getTableAliases
public org.eclipse.persistence.internal.expressions.TableAliasLookup getTableAliases()
INTERNAL: Return the aliases used. By default, return null, since we don't have tables.
-
greaterThan
public Expression greaterThan(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(char theChar)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(double theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(float theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(int theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(long theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receiver's value is greater than the other value. This is equivalent to the SQL ">" operator.
-
greaterThan
public Expression greaterThan(Expression theValue)
-
greaterThan
public Expression greaterThan(short theValue)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThan
public Expression greaterThan(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is equal to the other value. This is equivalent to the SQL "=" operator and Java "equals" method.
-
greaterThanEqual
public Expression greaterThanEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
greaterThanEqual
public Expression greaterThanEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is greater and equal to the other value. This is equivalent to the SQL ">=" operator.
-
hasAsOfClause
public boolean hasAsOfClause()
ADVANCED: Answers true ifthisis to be queried as of a past time.- Returns:
- false from
asOf(null); hasAsOfClause(). - See Also:
getAsOfClause()
-
hasBeenAliased
public boolean hasBeenAliased()
INTERNAL: Answers if the database tables associated with this expression have been aliased. This insures the same tables are not aliased twice.
-
hexToRaw
public Expression hexToRaw()
PUBLIC: Function, returns binary array value for the hex string.
-
ifNull
public Expression ifNull(java.lang.Object nullValue)
PUBLIC: Function return a specific value if item returned from the query is null. Equivalent of the oracle NVL functionExample:
EclipseLink: employee.get("name").ifNull("no-name") Java: NA SQL: NVL(name, 'no-name')
-
in
public Expression in(byte[] theBytes)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
in
public Expression in(java.util.Collection theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
-
in
public Expression in(Expression arguments)
-
in
public Expression in(ReportQuery subQuery)
-
index
public Expression index()
-
indexOf
public Expression indexOf(java.lang.Object substring)
PUBLIC: Function, returns the integer index of the substring within the source string.
-
isClassTypeExpression
public boolean isClassTypeExpression()
INTERNAL:
-
isCompoundExpression
public boolean isCompoundExpression()
INTERNAL:
-
isConstantExpression
public boolean isConstantExpression()
INTERNAL:
-
isDataExpression
public boolean isDataExpression()
INTERNAL:
-
isEmpty
public Expression isEmpty(java.lang.String attributeName)
PUBLIC: A logical expression for the collectionattributeNamebeing empty. Equivalent tosize(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)- See Also:
size(java.lang.String)
-
isExpressionBuilder
public boolean isExpressionBuilder()
INTERNAL:
-
isFieldExpression
public boolean isFieldExpression()
INTERNAL:
-
isFunctionExpression
public boolean isFunctionExpression()
INTERNAL:
-
isLiteralExpression
public boolean isLiteralExpression()
INTERNAL:
-
isLogicalExpression
public boolean isLogicalExpression()
INTERNAL:
-
isNull
public Expression isNull()
PUBLIC: Compare to null.
-
isObjectExpression
public boolean isObjectExpression()
INTERNAL:
-
isParameterExpression
public boolean isParameterExpression()
INTERNAL:
-
isQueryKeyExpression
public boolean isQueryKeyExpression()
INTERNAL:
-
isRelationExpression
public boolean isRelationExpression()
INTERNAL:
-
isSubSelectExpression
public boolean isSubSelectExpression()
INTERNAL:
-
isTableExpression
public boolean isTableExpression()
INTERNAL:
-
isTreatExpression
public boolean isTreatExpression()
INTERNAL:
-
isMapEntryExpression
public boolean isMapEntryExpression()
INTERNAL:
-
isValueExpression
public boolean isValueExpression()
INTERNAL: Subclasses implement (isParameterExpression() || isConstantExpression())
-
iterateOn
public void iterateOn(org.eclipse.persistence.internal.expressions.ExpressionIterator iterator)
INTERNAL: For iterating using an inner class
-
lastDay
public Expression lastDay()
PUBLIC: Function, returns the date with the last date in the months of this source date.
-
leftPad
public Expression leftPad(int size, java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size.
-
leftPad
public Expression leftPad(java.lang.Object size, java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size.
-
leftTrim
public Expression leftTrim()
PUBLIC: Function, returns the string left trimmed for white space.
-
leftTrim
public Expression leftTrim(java.lang.Object substring)
PUBLIC: Function, returns the string with the substring trimed from the left.
-
length
public Expression length()
PUBLIC: Function, returns the size of the string.
-
lessThan
public Expression lessThan(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(char theChar)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(double theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(float theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(int theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(long theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(Expression theValue)
-
lessThan
public Expression lessThan(short theValue)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThan
public Expression lessThan(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is less than the other value. This is equivalent to the SQL "<" operator.
-
lessThanEqual
public Expression lessThanEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public 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. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
lessThanEqual
public Expression lessThanEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is less than and equal to the other value. This is equivalent to the SQL "<=" operator.
-
like
public Expression like(java.lang.String value)
PUBLIC: Return an expression that compares if the receivers value is like other value. This is equivalent to the SQL "LIKE" operator that except wildcards. The character "%" means any sequence of characters and the character "_" mean any character. i.e. "B%" == "Bob", "B_B" == "BOB"Example:
EclipseLink: employee.get("firstName").like("B%") Java: NA SQL: F_NAME LIKE 'B%'
-
like
public Expression like(java.lang.String value, java.lang.String escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is like other value. This is equivalent to the SQL "LIKE ESCAPE" operator that except wildcards. The character "%" means any sequence of characters and the character "_" mean any character. i.e. "B%" == "Bob", "B_B" == "BOB" The escape sequence specifies a set of characters the may be used to indicate that an one of the wildcard characters should be interpreted literally.Example:
EclipseLink: employee.get("firstName").like("B\_SMITH", "\") Java: NA SQL: F_NAME LIKE 'B\_SMITH ESCAPE '\''
-
like
public Expression like(Expression argument)
PUBLIC: Return an expression that compares if the receivers value is like other value. This is equivalent to the SQL "LIKE" operator that except wildcards. The character "%" means any sequence of characters and the character "_" mean any character. i.e. "B%" == "Bob", "B_B" == "BOB"Example:
EclipseLink: employee.get("firstName").like("B%") Java: NA SQL: F_NAME LIKE 'B%'
-
regexp
public Expression regexp(java.lang.String regexp)
PUBLIC: Return an expression that compares if the receivers value matches the regular expression. This uses the databases support for regular expression. Regular expressions are similar to LIKE except support a much larger scope of comparisons. i.e. "^B.*" == "Bob", "^B.B$" == "BOB"Example:
EclipseLink: employee.get("firstName").regexp("^B.*") Java: Pattern.compile("^B.*").matcher(employee.getFirstName()).matches() SQL: F_NAME REGEXP '^B.*'
-
regexp
public Expression regexp(Expression regexp)
PUBLIC: Return an expression that compares if the receivers value matches the regular expression. This uses the databases support for regular expression. Regular expressions are similar to LIKE except support a much larger scope of comparisons. i.e. "^B.*" == "Bob", "^B.B$" == "BOB"Example:
EclipseLink: employee.get("firstName").regexp("^B.*") Java: Pattern.compile("^B.*").matcher(employee.getFirstName()).matches() SQL: F_NAME REGEXP '^B.*'
-
like
public Expression like(Expression value, Expression escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is like other value. This is equivalent to the SQL "LIKE ESCAPE" operator that except wildcards. The character "%" means any sequence of characters and the character "_" mean any character. i.e. "B%" == "Bob", "B_B" == "BOB" The escape sequence specifies a set of characters the may be used to indicate that an one of the wildcard characters should be interpreted literally.Example:
EclipseLink: employee.get("firstName").like("B\_SMITH", "\") Java: NA SQL: F_NAME LIKE 'B\_SMITH ESCAPE '\''
-
likeIgnoreCase
public Expression likeIgnoreCase(java.lang.String theValue)
PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case. This is a case in-sensitive like.Example:
EclipseLink: employee.get("firstName").likeIgnoreCase("%Bob%") Java: none SQL: UPPER(F_NAME) LIKE 'BOB'
-
likeIgnoreCase
public Expression likeIgnoreCase(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is like the other value, ignoring case. This is a case in-sensitive like.
-
locate
public Expression locate(java.lang.Object str)
PUBLIC: Function, returns the position ofstrinthisExample:
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.
-
locate
public Expression locate(java.lang.String str, int fromIndex)
PUBLIC: Function, returns the position ofstrinthis, starting the search atfromIndex.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.
-
locate
public Expression locate(java.lang.Object str, java.lang.Object fromIndex)
PUBLIC: Function, returns the position ofstrinthis, starting the search atfromIndex.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.
-
maximum
public Expression maximum()
PUBLIC: This represents the aggregate function Maximum. Can be used only within Report Queries.
-
minimum
public Expression minimum()
PUBLIC: This represents the aggregate function Minimum. Can be used only within Report Queries.
-
monthsBetween
public Expression monthsBetween(java.lang.Object otherDate)
PUBLIC: Function, returns the decimal number of months between the two dates.
-
mapEntry
public 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()- Returns:
-
mapKey
public 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()- Returns:
-
newTime
public Expression newTime(java.lang.String timeZoneFrom, java.lang.String timeZoneTo)
PUBLIC: funcation return a date converted to a new timezone. Equivalent of the Oracle NEW_TIME functionExample:
EclipseLink: employee.get("date").newTime("EST", "PST") Java: NA SQL: NEW_TIME(date, 'EST', 'PST')
-
nextDay
public Expression nextDay(java.lang.Object dayName)
PUBLIC: Function, returns the date with the next day from the source date as the day name given.
-
noneOf
public Expression noneOf(java.lang.String attributeName, Expression criteria)
PUBLIC: Returns an expression equivalent to none ofattributeNameholding true forcriteria.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
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").equal("613"))); Expression exp = employee.notExists(subQuery);- Parameters:
criteria- must have its own builder, as it will become the separate selection criteria of a subQuery.- Returns:
- a notExists subQuery expression
-
normalize
public Expression normalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)
INTERNAL: Normalize into a structure that is printable. Also compute printing information such as outer joins.
-
not
public Expression not()
PUBLIC: Return an expression that is the boolean logical negation of the expression. This is equivalent to the SQL "NOT" operator and the Java "!" operator.Example:
EclipseLink: employee.get("age").equal(24).not() Java: (! (employee.getAge() == 24)) SQL: NOT (AGE = 24)
-
notBetween
public Expression notBetween(byte leftValue, byte rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(char leftChar, char rightChar)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(double leftValue, double rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(float leftValue, float rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(int leftValue, int rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(long leftValue, long rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public 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. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(Expression leftExpression, Expression rightExpression)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notBetween
public Expression notBetween(short leftValue, short rightValue)
PUBLIC: Return an expression that compares if the receivers value is not between two other values. Equivalent to between negated.- See Also:
between(Object, Object)
-
notEmpty
public Expression notEmpty(java.lang.String attributeName)
PUBLIC: A logical expression for the collectionattributeNamenot being empty. Equivalent tosize(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)- See Also:
size(java.lang.String)
-
notEqual
public Expression notEqual(byte theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(char theChar)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(double theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(float theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(int theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(long theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(java.lang.Object theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(Expression theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(short theValue)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notEqual
public Expression notEqual(boolean theBoolean)
PUBLIC: Return an expression that compares if the receivers value is not equal to the other value. This is equivalent to the SQL "<>" operator- See Also:
equal(Object)
-
notExists
public Expression notExists(ReportQuery subQuery)
PUBLIC: Return a sub query expression. A sub query using a report query to define a subselect within another queries expression or select's where clause. The sub query (the report query) will use its own expression builder be can reference expressions from the base expression builder.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);
-
notIn
public Expression notIn(byte[] theBytes)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(ReportQuery subQuery)
-
notIn
public Expression notIn(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
notIn
public Expression notIn(java.util.Collection theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. The collection can be a collection of constants or expressions. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
-
notIn
public Expression notIn(Expression arguments)
-
notLike
public Expression notLike(java.lang.String aString)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. Equivalent to like negated.- See Also:
like(String)
-
notLike
public Expression notLike(Expression arguments)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. Equivalent to like negated.- See Also:
like(String)
-
notLike
public 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. Equivalent to like negated.- Parameters:
value- string to compareescapeSequence- the escape character to use- See Also:
like(String)
-
notLike
public Expression notLike(Expression value, Expression escapeSequence)
PUBLIC: Return an expression that compares if the receivers value is not like the other value. Equivalent to like negated.- Parameters:
value- string to compareescapeSequence- the escape character to use- See Also:
like(String)
-
notNull
public Expression notNull()
PUBLIC: Return an expression representing a comparison to nullExample:
EclipseLink: employee.get("age").notNull() Java: employee.getAge() != null SQL: AGE IS NOT NULL
-
or
public Expression or(Expression theExpression)
PUBLIC: Return an expression that is the boolean logical combination of both expressions. This is equivalent to the SQL "OR" operator and the Java "||" operator.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'
-
performOperator
public Expression performOperator(ExpressionOperator anOperator, java.util.List args)
INTERNAL:
-
postCopyIn
protected void postCopyIn(java.util.Map alreadyDone)
-
postfixSQL
public Expression postfixSQL(java.lang.String sqlString)
ADVANCED: Inserts the SQL as is directly into the expression. The sql will be printed immediately after (postfixed to) the sql for this. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.
-
prefixSQL
public Expression prefixSQL(java.lang.String sqlString)
ADVANCED: Insert the SQL as is directly into the expression. The sql will be printed immediately before (prefixed to) the sql for this. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.
-
printSQL
public abstract void printSQL(org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer)
INTERNAL: Print SQL
-
printJava
public void printJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)
INTERNAL: Print java for project class generation
-
rebuildOn
public abstract Expression rebuildOn(Expression newBase)
INTERNAL: This expression is built on a different base than the one we want. Rebuild it and return the root of the new tree If receiver is a complex expression, use cloneUsing(newBase) instead.- See Also:
cloneUsing(Expression newBase)
-
resetPlaceHolderBuilder
public 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. This happens in case of an Exists call using a new ExpressionBuilder(). This builder needs to be replaced with one from the query.
-
ref
public Expression ref()
ADVANCED: For Object-relational support.
-
registerIn
protected Expression registerIn(java.util.Map alreadyDone)
-
replace
public 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.
-
replicate
public Expression replicate(int constant)
PUBLIC: return the result of this query repeated a given number of times. Equivalent of the Sybase REPLICATE functionExample:
EclipseLink: employee.get("name").replicate(2) Java: NA SQL: REPLICATE(name, 2)
-
replicate
public Expression replicate(java.lang.Object theValue)
PUBLIC: return the result of this query repeated a given number of times. Equivalent of the Sybase REPLICATE functionExample:
EclipseLink: employee.get("name").replicate(2) Java: NA SQL: REPLICATE(name, 2)
-
resetCache
protected void resetCache()
Reset cached information here so that we can be sure we're accurate.
-
reverse
public Expression reverse()
PUBLIC: Function return the reverse of the query result. Equivalent of the Sybase REVERSE functionExample:
EclipseLink: employee.get("name").reverse() Java: NA SQL: REVERSE(name)
-
right
public Expression right(int characters)
PUBLIC: Function return a given number of characters starting at the right of a string. Equivalent to the Sybase RIGHT functionExample:
EclipseLink: employee.get("name").right(2) Java: NA SQL: RIGHT(name, 2)
-
right
public Expression right(java.lang.Object characters)
PUBLIC: Function return a given number of characters starting at the right of a string. Equivalent to the Sybase RIGHT functionExample:
EclipseLink: employee.get("name").right(2) Java: NA SQL: RIGHT(name, 2)
-
rightPad
public Expression rightPad(int size, java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size.
-
rightPad
public Expression rightPad(java.lang.Object size, java.lang.Object substring)
PUBLIC: Function, returns the string padded with the substring to the size.
-
rightTrim
public Expression rightTrim()
PUBLIC: Function, returns the string right trimmed for white space.
-
rightTrim
public Expression rightTrim(java.lang.Object substring)
PUBLIC: Function, returns the string with the substring trimed from the right.
-
roundDate
public Expression roundDate(java.lang.Object yearOrMonthOrDayRoundToken)
PUBLIC: Function, returns the date rounded to the year, month or day.
-
selectIfOrderedBy
public boolean selectIfOrderedBy()
PUBLIC: Return whether this expression should be included in the SELECT clause if it is used in an ORDER BY clause
-
setLocalBase
public 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.
-
setSelectIfOrderedBy
public 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.- Parameters:
selectIfOrderedBy-
-
shallowClone
public Expression shallowClone()
INTERNAL:
-
size
public Expression size(java.lang.String attributeName)
PUBLIC: A logical expression for the size of collectionattributeName.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))
-
size
public Expression size(java.lang.Class returnType)
PUBLIC: A logical expression for the size of collection expression.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))
-
standardDeviation
public Expression standardDeviation()
PUBLIC: This represents the aggregate function StandardDeviation. Can be used only within Report Queries.
-
subQuery
public Expression subQuery(ReportQuery subQuery)
PUBLIC: Return a sub query expression. A sub query using a report query to define a subselect within another queries expression or select's where clause. The sub query (the report query) will use its own expression builder be can reference expressions from the base expression builder.Example:
ExpressionBuilder builder = new ExpressionBuilder(); ReportQuery subQuery = new ReportQuery(Employee.class, new ExpressionBuilder()); subQuery.addMaximum("salary"); builder.get("salary").equal(builder.subQuery(subQuery));
-
substring
public Expression substring(int startPosition, int size)
PUBLIC: Function, returns the substring from the source string. EclipseLink: employee.get("firstName").substring(1, 2) Java: NA SQL: SUBSTR(FIRST_NAME, 1, 2)
-
substring
public Expression substring(java.lang.Object startPosition, java.lang.Object size)
PUBLIC: Function, returns the substring from the source string. EclipseLink: employee.get("firstName").substring(1, 2) Java: NA SQL: SUBSTR(FIRST_NAME, 1, 2)
-
substring
public Expression substring(int startPosition)
PUBLIC: Function, returns the substring from the source string. EclipseLink: employee.get("firstName").substring(1) Java: NA SQL: SUBSTR(FIRST_NAME, 1)
-
substring
public Expression substring(java.lang.Object startPosition)
PUBLIC: Function, returns the substring from the source string. EclipseLink: employee.get("firstName").substring(1) Java: NA SQL: SUBSTR(FIRST_NAME, 1)
-
sum
public Expression sum()
PUBLIC: This represents the aggregate function Sum. Can be used only within Report Queries.
-
toCharacter
public Expression toCharacter()
PUBLIC: Function, returns the single character string with the ascii or character set value.
-
toDate
public Expression toDate()
PUBLIC: Function, returns date from the string using the default format.
-
toChar
public Expression toChar()
PUBLIC: Return an expression that represents the receiver value converted to a character string. This is equivalent to the SQL "TO_CHAR" operator and Java "toString" method.Example:
EclipseLink: employee.get("salary").toChar().equal("100000") Java: employee.getSalary().toString().equals("100000") SQL: TO_CHAR(SALARY) = '100000'
-
toChar
public 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. 'year', 'yyyy', 'day', etc.). This is equivalent to the SQL "TO_CHAR" operator and Java Date API.Example:
EclipseLink: employee.get("startDate").toChar("day").equal("monday") Java: employee.getStartDate().getDay().equals("monday") SQL: TO_CHAR(START_DATE, 'day') = 'monday'
-
toLowerCase
public Expression toLowerCase()
PUBLIC: Return an expression that represents the receiver value converted to lower case. This is equivalent to the SQL "LOWER" operator and Java "toLowerCase" method. This is only allowed for String attribute values.Example:
EclipseLink: employee.get("firstName").toLowerCase().equal("bob") Java: employee.getFirstName().toLowerCase().equals("bob") SQL: LOWER(F_NAME) = 'bob'
-
toNumber
public Expression toNumber()
PUBLIC: Function, returns the number converted from the string.
-
toString
public java.lang.String toString()
PUBLIC: Print a debug form of the expression tree.- Overrides:
toStringin classjava.lang.Object
-
toString
public void toString(java.io.BufferedWriter writer, int indent) throws java.io.IOExceptionINTERNAL: Print a debug form of the expression tree.- Throws:
java.io.IOException
-
toUpperCase
public Expression toUpperCase()
PUBLIC: Return an expression that represents the receiver value converted to upper case. This is equivalent to the SQL "UPPER" operator and Java "toUpperCase" method. This is only allowed for String attribute values.Example:
EclipseLink: employee.get("firstName").toUpperCase().equal("BOB") Java: employee.getFirstName().toUpperCase().equals("BOB") SQL: UPPER(F_NAME) = 'BOB'
-
toUppercaseCasedWords
public Expression toUppercaseCasedWords()
PUBLIC: Function, returns the string with the first letter of each word capitalized.
-
translate
public 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.
-
trim
public Expression trim()
PUBLIC: Function, returns the string trimmed for white space.
-
trim
public Expression trim(java.lang.Object substring)
PUBLIC: Function, returns the string right and left trimmed for the substring.
-
extractXml
public Expression extractXml(java.lang.String xpath)
PUBLIC: XMLType Function, extracts a secton of XML from a larget XML document- Parameters:
xpath- XPath expression representing the node to be returned
-
extract
public Expression extract(java.lang.String part)
PUBLIC: Extract the date part from the date/time value. EXTRACT is part of the SQL standard, so should be supported by most databases.- Parameters:
part- is the date part to extract, "YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "TIMEZONE_HOUR", "TIMEZONE_MINUTE".
-
cast
public Expression cast(java.lang.String type)
PUBLIC: Cast the value to the database type. CAST is part of the SQL standard, so should be supported by most databases.- Parameters:
type- is the database type name, this is database specific but should include, "CHAR", "VARCHAR", "NUMERIC", "INTEGER", "DATE", "TIME", "TIMESTAMP", the type may include a size and scale.
-
extractValue
public Expression extractValue(java.lang.String xpath)
PUBLIC: XMLType Function, extracts a value from an XMLType field- Parameters:
xpath- XPath expression
-
existsNode
public 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- Parameters:
xpath- Xpath expression
-
isFragment
public Expression isFragment()
PUBLIC: XMLType Function - evaluates to 0 if the xml is a well formed document and 1 if the document is a fragment
-
getStringVal
public Expression getStringVal()
PUBLIC: XMLType Function - gets a string value from an XMLType
-
getNumberVal
public Expression getNumberVal()
PUBLIC: XMLType Function - gets a number value from an XMLType
-
truncateDate
public Expression truncateDate(java.lang.String datePart)
PUBLIC: return the date truncated to the indicated datePart. Equivalent to the Sybase TRUNC function for datesExample:
EclipseLink: employee.get("date").truncDate(year) Java: NA SQL: TRUNC(date, year)
-
twist
public 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. We need to transform it so it refers to the objects we are dealing with, and AND it into the rest of our expression. We want to replace the original base expression with (newBase), and any parameters will be given values based on the context which (this) provides. For example, suppose that the main expression is emp.address.streetName = 'something' and we are trying to twist the selection criteria for the mapping 'address' in Employee. Because that mapping selects addresses, we will use the 'address' node as the base. Values for any parameters will come from the 'emp' node, which was the base of the original expression. Note that the values need not be constants, they can be fields. We do this by taking the tree we're trying to merge and traverse it more or less re-executing it it with the appropriate initial receiver and context. Return the root of the new expression tree. This will probably need to be AND'ed with the root of the old tree.
-
twistedForBaseAndContext
public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)
INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist See the comment there for more details"
-
validateNode
public void validateNode()
INTERNAL: Do any required validation for this node. Throw an exception for any incorrect constructs.
-
value
public Expression value()
PUBLIC: Function, this represents the value function, used in nestedtable
-
value
public Expression value(byte constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(char constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(double constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(float constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(int constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(long constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(java.lang.Object constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(short constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
value
public Expression value(boolean constant)
PUBLIC: Return an expression on the constant.Example:
reportQuery.addItem("a constant", builder.value("a constant"));
-
literal
public Expression literal(java.lang.String literal)
ADVANCED: Return an expression on the literal. A literal is a specific SQL syntax string that will be printed as is without quotes in the SQL. It can be useful for printing database key words or global variables.Example:
reportQuery.addItem("currentTime", builder.literal("SYSDATE"));
-
alias
public Expression alias(java.lang.String alias)
ADVANCED: Return an expression for the alias. This allows an alias used in the select clause to be used in other clauses.
-
valueFromObject
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)INTERNAL: Return the value for in memory comparison. This is only valid for valueable expressions. New parameter added for feature 2612601- Parameters:
isObjectUnregistered- true if object possibly not a clone, but is being conformed against the unit of work cache.
-
valueFromObject
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)INTERNAL: Return the value for in memory comparison. This is only valid for valueable expressions.
-
variance
public Expression variance()
PUBLIC: Function, this represents the aggregate function Variance. Can be used only within Report Queries.
-
writeDescriptionOn
public void writeDescriptionOn(java.io.BufferedWriter writer) throws java.io.IOExceptionINTERNAL: Used to print a debug form of the expression tree.- Throws:
java.io.IOException
-
writeField
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. Should be overridden for special operators such as functions.
-
writeAlias
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. This is used for pessimistic locking.
-
writeFields
public 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(...)
-
writeSubexpressionsTo
public void writeSubexpressionsTo(java.io.BufferedWriter writer, int indent) throws java.io.IOExceptionINTERNAL: Used in SQL printing.- Throws:
java.io.IOException
-
any
public Expression any(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. The ANY keyword denotes that the search condition is TRUE if the comparison is TRUE for at least one of the values that is returned. If the subquery returns no value, the search condition is FALSE
-
any
public Expression any(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
public Expression any(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
any
@Deprecated public Expression any(java.util.Vector theObjects)
Deprecated.since 2.4 replaced by any(List)PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)- See Also:
any(List)
-
any
public Expression any(java.util.List theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
-
any
public Expression any(Expression arguments)
-
union
public Expression union(Expression arguments)
PUBLIC: Return a union expression with the subquery.
-
intersect
public Expression intersect(ReportQuery query)
PUBLIC: Return a intersect expression with the subquery.
-
intersectAll
public Expression intersectAll(ReportQuery query)
PUBLIC: Return a intersect all expression with the subquery.
-
intersect
public Expression intersect(Expression arguments)
PUBLIC: Return a intersect expression with the subquery.
-
except
public Expression except(ReportQuery query)
PUBLIC: Return a except expression with the subquery.
-
exceptAll
public Expression exceptAll(ReportQuery query)
PUBLIC: Return a except all expression with the subquery.
-
except
public Expression except(Expression arguments)
PUBLIC: Return a except expression with the subquery.
-
union
public Expression union(ReportQuery query)
PUBLIC: Return a union expression with the subquery.
-
unionAll
public Expression unionAll(ReportQuery query)
PUBLIC: Return a union all expression with the subquery.
-
unionAll
public Expression unionAll(Expression arguments)
PUBLIC: Return a union all expression with the subquery.
-
intersectAll
public Expression intersectAll(Expression arguments)
PUBLIC: Return a intersect all expression with the subquery.
-
exceptAll
public Expression exceptAll(Expression arguments)
PUBLIC: Return a except all expression with the subquery.
-
any
public Expression any(ReportQuery subQuery)
-
some
public Expression some(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. The SOME keyword denotes that the search condition is TRUE if the comparison is TRUE for at least one of the values that is returned. If the subquery returns no value, the search condition is FALSE
-
some
public Expression some(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
public Expression some(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
some
@Deprecated public Expression some(java.util.Vector theObjects)
Deprecated.since 2.4 replaced by some(List)PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)- See Also:
some(List)
-
some
public Expression some(java.util.List theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
-
some
public Expression some(Expression arguments)
-
some
public Expression some(ReportQuery subQuery)
-
all
public Expression all(byte[] theBytes)
PUBLIC: Return an expression that is used with a comparison expression. The SOME keyword denotes that the search condition is TRUE if the comparison is TRUE for at least one of the values that is returned. If the subquery returns no value, the search condition is FALSE
-
all
public Expression all(char[] theChars)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(double[] theDoubles)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(float[] theFloats)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(int[] theInts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(long[] theLongs)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(java.lang.Object[] theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(short[] theShorts)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
public Expression all(boolean[] theBooleans)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.
-
all
@Deprecated public Expression all(java.util.Vector theObjects)
Deprecated.since 2.4 replaced by all(List)PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)- See Also:
all(List)
-
all
public Expression all(java.util.List theObjects)
PUBLIC: Return an expression that checks if the receivers value is contained in the collection. This is equivalent to the SQL "IN" operator and Java "contains" operator.Example:
EclipseLink: employee.get("age").in(ages) Java: ages.contains(employee.getAge()) SQL: AGE IN (55, 18, 30)
-
all
public Expression all(Expression arguments)
-
all
public Expression all(ReportQuery subQuery)
-
getLeafDescriptor
public ClassDescriptor getLeafDescriptor(DatabaseQuery query, ClassDescriptor rootDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Lookup the descriptor for this item by traversing its expression recursively.
-
getLeafMapping
public DatabaseMapping getLeafMapping(DatabaseQuery query, ClassDescriptor rootDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Lookup the mapping for this item by traversing its expression recursively. If an aggregate of foreign mapping is found it is traversed.
-
-