/
Querying Data
Querying Data
Function | Syntax | Description | Example |
---|---|---|---|
all | Obj:all() | Returns all records from the table. | Person[] plist = Person:all(); |
equals | Obj:equals(a,b) | Returns records with value of | Person[] plist = Person:equals(deleted, false); |
notEquals | Obj:notEquals(a,b) | Returns records with value of a not equal to b . | Person[] plist = Person:notEquals(deleted, true); |
empty | Obj:empty(a) | Returns records with a equal to null . | Person[] plist = Person:empty(mobileNum); |
notEmpty | Obj:notEmpty(a) | Returns records with a not equal to null . | Person[] plist = Person:notEmpty(mobileNum); |
between | Obj:between(a,x,y) | Returns records with value of a within the range of values between x and y . | Person[] plist = Person:between(dob, date1, date2); |
notBetween | Obj:notBetween(a,x,y) | Returns records with value of a not within the range of values between x and y . | Person[] plist = Person:notBetween(dob, date1, date2); |
lessThanOrEqual | Obj:lessThanOrEqual(a,b) | Returns records with value of a less than or equal to b . | Person[] plist = Person:lessThanOrEqual(age, num); |
lessThan | Obj:lessThan(a,b) | Returns records with value of a less than b . | Person[] plist = Person:lessThan(age, num); |
greaterThan | Obj:greaterThan(a,b) | Returns records with value of a greater than b . | Person[] plist = Person:greaterThan(age, num); |
attributeIn | Obj:attributeIn(a,b) | Returns records with value of a matching any of the values b (replace b with a list of values of the same type as a ). | Person[] plist = Person:attributeIn(state, state_list); |
notAttributeIn | Obj:notAttributeIn(a,b) | Returns records with value of a not matching any of the values b (replace b with a list of values of the same type as a ). | Person[] plist = Person:notAttributeIn(state, state_list); |
relationshipIn | Obj:relationshipIn(a,b) | Returns records with a relationship/link between a and b , with attribute a being annotated as @OneToMany , @ManyToOne , etc. and b a persistent object instance. Attribute a can be likened to a foreign key. | Person[] plist = Person:relationshipIn(reportsTo, person); |
notRelationshipIn | Obj:notRelationshipIn(a,b) | Returns records without a relationship/link between a and b , with attribute a being annotated as @OneToMany , @ManyToOne , etc. and b a persistent object instance. Attribute a can be likened to a foreign key. | Person[] plist = Person:notRelationshipIn(reportsTo, person); |
contains | Obj:contains(a,b) | Returns records with substring b found anywhere within value of a . | Person[] plist = Person:contains(name, "a"); |
beginsWith | Obj:beginsWith(a,b) | Returns records with substring b found at the beginning of the value of a . | Person[] plist = Person:beginsWith(name, "a"); |
endsWith | Obj:endsWith(a,b) | Returns records with substring b found at the end of the value of a . | Person[] plist = Person:endsWith(name, "a"); |
notContains | Obj:notContains(a,b) | Returns records with substring b found nowhere within value of a . | Person[] plist = Person:notContains(name, "a"); |
notBeginWith | Obj:notBeginWith(a,b) | Returns records with substring b not found at the beginning of the value of a . | Person[] plist = Person:notBeginWith(name, "a"); |
notEndsWith | Obj:notEndsWith(a,b) | Returns records with substring b not found at the end of the value of a . | Person[] plist = Person:notEndsWith(name, "a"); |
union | Obj:union(selector1(a,b), selector2(x,y)) | Combines the results of two or more selectors. Does not return the same record twice. | Person[] plist = Person:union(equals(rating, "good"), equals(rating, "excellent")); |
diff | Obj:diff(selector1(a,b), selector2(x,y)) | Compares the results of two or more selectors and returns only the difference. | Person[] plist = Person:diff(equals(), equals()); |
intersect | Obj:intersect(selector1(a,b), selector2(x,y)) | Returns records for which all the selectors are true. | Person[] plist = Person:intersect(equals(deleted, false), equals(active, true)); |
and | Obj:and(selector1(a,b), selector2(x,y)) | Returns records for which all the selectors are true. | Person[] plist = Person:and(equals(deleted, false), equals(active, true)); |
, multiple selections available,
Related content
Collections
Collections
More like this
<table/>
<table/>
More like this
Quick Reference
Quick Reference
Read with this
(Complex) Nested vs. (Simple) Separated Selectors
(Complex) Nested vs. (Simple) Separated Selectors
More like this
String Functions
String Functions
Read with this
Lesson 22: Executing SQL Select Queries From the DSL
Lesson 22: Executing SQL Select Queries From the DSL
More like this