Interface OrientDBTemplate
- All Superinterfaces:
org.eclipse.jnosql.mapping.document.DocumentTemplate,org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate,jakarta.nosql.Template
public interface OrientDBTemplate
extends org.eclipse.jnosql.mapping.document.DocumentTemplate
A specialized
DocumentTemplate for OrientDB.
This template provides methods for executing native SQL queries, live queries, and queries with named parameters.
-
Method Summary
Modifier and TypeMethodDescription<T> voidlive(String query, OrientDBLiveCallback<T> callBacks, Object... params) Executes a live query in OrientDB using a SQL string.<T> voidlive(org.eclipse.jnosql.communication.semistructured.SelectQuery query, OrientDBLiveCallback<T> callBacks) Executes a live query in OrientDB.<T> Stream<T>Executes a native OrientDB SQL query.<T> Stream<T>Executes a native OrientDB SQL query with named parameters.Methods inherited from interface org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate
count, count, count, delete, deleteAll, exists, findAll, prepare, prepare, query, query, select, selectCursor, selectOffSet, singleResult, singleResult, singleResultMethods inherited from interface jakarta.nosql.Template
delete, delete, find, insert, insert, insert, insert, select, update, update
-
Method Details
-
sql
Executes a native OrientDB SQL query. This method allows running SQL queries with positional parameters. Example usage:Stream<User> users = template.sql("SELECT FROM User WHERE age > ?", 30);- Type Parameters:
T- the expected result type- Parameters:
query- the SQL query stringparams- optional positional parameters for the query- Returns:
- a stream of results matching the query
- Throws:
NullPointerException- if the query or params are null
-
sql
Executes a native OrientDB SQL query with named parameters. Example usage:Map<String, Object> params = Map.of("age", 30); Stream<User> users = template.sql("SELECT FROM User WHERE age > :age", params);- Type Parameters:
T- the expected result type- Parameters:
query- the SQL query stringparams- a map of named parameters for the query- Returns:
- a stream of results matching the query
- Throws:
NullPointerException- if the query or params are null
-
live
<T> void live(org.eclipse.jnosql.communication.semistructured.SelectQuery query, OrientDBLiveCallback<T> callBacks) Executes a live query in OrientDB. A live query listens for real-time changes in the database and triggers callbacks for each event that occurs (insert, update, delete). Example usage:template.live(selectQuery, event -> System.out.println("Update: " + event));- Type Parameters:
T- the expected result type- Parameters:
query- the query definition usingSelectQuerycallBacks- callback to handle live query events- Throws:
NullPointerException- if either query or callBacks is null
-
live
Executes a live query in OrientDB using a SQL string. The query must include the "LIVE" keyword. Example usage:template.live("LIVE SELECT FROM User", event -> System.out.println("User changed: " + event));- Type Parameters:
T- the expected result type- Parameters:
query- the SQL query string containing the "LIVE" keywordcallBacks- callback to handle live query eventsparams- optional positional parameters for the query- Throws:
NullPointerException- if either query or callBacks is null
-