-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Introduce a new API in Jakarta NoSQL that allows executing string-based queries defined by the Jakarta Query specification.
This integration will support executing JPQL-like queries using Jakarta NoSQL’s Template API, mirroring the developer experience found in Jakarta Persistence.
🎯 Goals:
-
Provide support for Jakarta Query string-based queries.
-
Support the main query operations:
selectvia.result()updatevia.executeUpdate()deletevia.executeDelete()
-
Enable a fluent interface via
Template.query(String, Class<T>)returning aQuery<T>instance. -
Support both named (
:param) and positional (?1) parameters via.bind()methods.
💡 Usage Example:
@Inject
Template template;
List<Word> results = template.query("from Word where term = 'java'", Word.class)
.result();
template.query("update Word set meaning = 'coffee' where term = 'java'", Word.class)
.executeUpdate();
template.query("delete from Word where term = 'obsolete'", Word.class)
.executeDelete();With named and positional parameters:
template.query("from Word where term = :term", Word.class)
.bind("term", "java")
.result();
template.query("from Word where term = ?1", Word.class)
.bind(1, "java")
.result();Since NoSQL databases typically offer eventual consistency, the update() and delete() operations will return void to avoid giving the impression of guaranteed immediate persistence.
🧪 TCK Note:
This feature must include a Technology Compatibility Kit (TCK) covering:
- Selection queries
- Update queries
- Deletion queries
✅ Checklist:
-
Extend
Templatewith a new method:query(String query, Class<T> type) -
Define the
Query<T>interface with:List<T> result()void executeUpdate()void executeDelete()Query<T> bind(String name, Object value)Query<T> bind(int position, Object value)
-
Implement internal logic to parse and map string queries to execution
-
Add TCK tests for:
selectwith both parameter typesupdatewith both parameter typesdeletewith both parameter types
-
Update the Jakarta NoSQL specification with API details and examples
-
Provide user documentation with complete usage samples