Support `special_expression` keywords (e.g., `LOCAL DATE`, `TRUE`, `FALSE`) in Eclipse JNoSQL query processing for `select`, `update`, and `delete`
Eclipse JNoSQL should support the special_expression rule defined in the Jakarta Query grammar, which includes special constants such as:
LOCAL DATELOCAL TIMELOCAL DATETIMETRUEFALSE
These expressions must be supported consistently across all query operations:
selectupdatedelete
🤝 Specification Alignment
This enhancement ensures Eclipse JNoSQL remains compatible with Jakarta Query, and by extension, with Jakarta NoSQL and Jakarta Persistence that use this grammar.
🔁 Mapping Table
| Jakarta Query Syntax | Java Type | Java Equivalent |
|---|---|---|
LOCAL DATE |
java.time.LocalDate |
LocalDate.now() |
LOCAL TIME |
java.time.LocalTime |
LocalTime.now() |
LOCAL DATETIME |
java.time.LocalDateTime |
LocalDateTime.now() |
TRUE |
boolean / Boolean |
true |
FALSE |
boolean / Boolean |
false |
1. Select query
template.query("from Event where scheduledAt >= LOCAL DATE and active = TRUE", Event.class)
.result();
2. Update query
template.query("update Event set active = FALSE where scheduledAt < LOCAL DATETIME", Event.class)
.executeUpdate();
3. Delete query
template.query("delete from Event where active = FALSE", Event.class)
.executeDelete();
-
❌ Parse and resolve
LOCAL DATE,LOCAL TIME, andLOCAL DATETIMEintojava.timeinstances at query runtime. -
[ ] Parse and resolve
TRUEandFALSEinto boolean values. -
[ ] Ensure this works for:
- [ ]
selectqueries - [ ]
updatequeries - [ ]
deletequeries
- [ ]
-
[ ] Add internal tests for all combinations.
-
[ ] Add documentation examples.
@dearrudam this we have the same issue with LOCAL and date operations.
It won't support those by default on mongodb, thus, I will work only on the true and false operator
@otaviojava, correct me if I'm wrong but or if I didn't get the core idea but, I think that we could define the local date operation during the translate query process to the MongoDB. For exemple:
template.query("from Event where scheduledAt >= LOCAL DATE and active = TRUE", Event.class)
.result();
It would be converted in runtime to something limilar to the code below:
db.Event.find({
scheduledAt: {
$gte: ISODate("2025-12-15T01:00:00+03:00")
},
active: true
})
@dearrudam, it could, but we need to define how to translate this expression on the communication layer.
The first question would be more if it makes sense to do this kind of change right now.
Maybe, find the function expression as spec and then start implementing here.