When writing the "filter" for a JDOQL Query you can make use of some methods on the various
Java types. The range of methods included as standard in JDOQL is not as flexible as with
the true Java types, but the ones that are available are typically of much use. In addition,
DataNucleus adds on many extensions to the JDO specifications providing all of the commonly
required methods. Below is a list of what is required by JDOQL in JDO 1.0 and JDO 2.0, and
what DataNucleus RDBMS supports.
This is for the "JDOQL2" implementation for RDBMS
. To enable the "JDOQL2" implementation
refer to the persistence property
datanucleus.query.JDOQL.implementation
.
|
Java Type
|
Method
|
Description
|
Specification
|
DataNucleus support
|
|
String
|
startsWith(String)
|
Returns if the string starts with the passed string
|
JDO 1.0, JDO 2.0
|
|
|
String
|
endsWith(String)
|
Returns if the string ends with the passed string
|
JDO 1.0, JDO 2.0
|
|
|
String
|
equals(String)
|
Returns if the strings are equal
|
|
|
|
String
|
indexOf(String)
|
Returns the first position of the passed string
|
JDO 2.0
|
|
|
String
|
indexOf(String, int)
|
Returns the position of the passed string, after the passed position
|
JDO 2.0
|
|
|
String
|
substring(int)
|
Returns the substring starting from the passed position
|
JDO 2.0
|
|
|
String
|
substring(int,int)
|
Returns the substring between the passed positions
|
JDO 2.0
|
|
|
String
|
toLowerCase()
|
Returns the string in lowercase
|
JDO 2.0
|
|
|
String
|
toUpperCase()
|
Retuns the string in UPPERCASE
|
JDO 2.0
|
|
|
String
|
matches(String pattern)
|
Returns whether string matches the passed expression. The pattern argument follows the rules of java.lang.String.matches method.
|
JDO 2.0
|
|
|
String
|
charAt(int)
|
Returns the character at the passed position
|
|
|
|
String
|
startsWith(String, int)
|
Returns if the string starts with the passed string, from the passed position
|
|
|
|
String
|
length()
|
Returns the length of the string
|
|
|
|
String
|
equals(String)
|
Returns if the string is equals to the passed string
|
|
|
|
String
|
trim()
|
Returns a trimmed version of the string
|
|
|
|
String
|
trimLeft()
|
Returns a trimmed version of the string (trimmed for leading spaces)
|
|
|
|
String
|
trimRight()
|
Returns a trimmed version of the string (trimmed for trailing spaces)
|
|
|
|
Collection
|
isEmpty()
|
Returns whether the collection is empty
|
JDO 1.0, JDO 2.0
|
|
|
Collection
|
contains(value)
|
Returns whether the collection contains the passed element
|
JDO 1.0, JDO 2.0
|
|
|
Collection
|
size()
|
Returns the number of elements in the collection
|
JDO 2.0
|
|
|
Map
|
isEmpty()
|
Returns whether the map is empty
|
JDO 1.0, JDO 2.0
|
|
|
List
|
get(index)
|
Returns the element at that position
|
|
|
|
Map
|
containsKey(key)
|
Returns whether the map contains the passed key
|
JDO 2.0
|
|
|
Map
|
containsValue(value)
|
Returns whether the map contains the passed value
|
JDO 2.0
|
|
|
Map
|
containsEntry(key, value)
|
Returns whether the map contains the passed entry
|
|
|
|
Map
|
get(key)
|
Returns the value from the map with the passed key
|
JDO 2.0
|
|
|
Map
|
size()
|
Returns the number of entries in the map
|
JDO 2.0
|
|
|
Math
|
abs(number)
|
Returns the absolute value of the passed number
|
JDO 2.0
|
|
|
Math
|
acos(number)
|
Returns the arc cosine of the passed number
|
|
|
|
Math
|
asin(number)
|
Returns the arc sine of the passed number
|
|
|
|
Math
|
atan(number)
|
Returns the arc tangent of the passed number
|
|
|
|
Math
|
ceil(number)
|
Returns the ceiling of the passed number
|
|
|
|
Math
|
cos(number)
|
Returns the cosine of the passed number
|
|
|
|
Math
|
exp(number)
|
Returns the exponent of the passed number
|
|
|
|
Math
|
floor(number)
|
Returns the floor of the passed number
|
|
|
|
Math
|
log(number)
|
Returns the log(base e) of the passed number
|
|
|
|
Math
|
sin(number)
|
Returns the absolute value of the passed number
|
|
|
|
Math
|
sqrt(number)
|
Returns the square root of the passed number
|
JDO 2.0
|
|
|
Math
|
tan(number)
|
Returns the tangent of the passed number
|
|
|
|
Date
|
getDay()
|
Returns the day (of the month) for the date
|
|
|
|
Date
|
getMonth()
|
Returns the month for the date
|
|
|
|
Date
|
getYear()
|
Returns the year for the date
|
|
|
|
Time
|
getHour()
|
Returns the hour for the time
|
|
|
|
Time
|
getMinute()
|
Returns the minute for the time
|
|
|
|
Time
|
getSecond()
|
Returns the second for the time
|
|
|
|
JDOHelper
|
getObjectId(object)
|
Returns the object identity of the passed persistent object
|
JDO 2.0
|
|
|
JDOHelper
|
getVersion(object)
|
Returns the object version of the passed persistent object
|
|
|
|
{}
|
length
|
Returns the length of an array
|
|
|
|
{}
|
contains(object)
|
Returns true if the array contains the object
|
|
|
|
Enum
|
ordinal
|
Returns the ordinal of the enum (not implemented for enum expression when
persisted as a string)
|
|
|
|
Enum
|
toString()
|
Returns the string form of the enum (not implemented for enum expression
when persisted as a numeric)
|
|
|
|
|
SQL_rollup({object})
|
Perform a rollup operation over the results.
Only available for some datastores e.g DB2, MSSQL, Oracle
|
|
|
|
|
SQL_cube({object})
|
Perform a cube operation over the results.
Only available for some datastores e.g DB2, MSSQL, Oracle
|
|
|
|
|
SQL_boolean({sql})
|
Embed the provided SQL and return a boolean result
|
|
|
|
|
SQL_numeric({sql})
|
Embed the provided SQL and return a numeric result
|
|
|
Here are a few examples using some of the extensions available for RDBMS with "JDOQL2".
Please refer to the JDOQL Methods Guide
for more examples of the JDO standard methods.