Interface ODatabase<T>
- All Superinterfaces:
AutoCloseable,Closeable,OBackupable
- All Known Subinterfaces:
ODatabaseDocument,ODatabaseDocumentInternal,ODatabaseInternal<T>,ODatabaseObject,ODatabaseSession
- All Known Implementing Classes:
ODatabaseDocumentAbstract,ODatabaseDocumentDistributed,ODatabaseDocumentDistributedPooled,ODatabaseDocumentEmbedded,ODatabaseDocumentEmbeddedPooled,ODatabaseDocumentRemote,ODatabaseDocumentRemotePooled,ODatabaseWrapperAbstract,OObjectDatabaseTx
Limits:
- Maximum records per cluster/class = 9.223.372.036 Billions: 2^63 = 9.223.372.036.854.775.808 records
- Maximum records per database = 302.231.454.903.657 Billions: 2^15 clusters x 2^63 records = (2^78) 32.768 * 9,223.372.036.854.775.808 = 302.231,454.903.657.293.676.544 records
- Maximum storage per database = 19.807.040.628.566.084 Terabytes: 2^31 data-segments x 2^63 bytes = (2^94) 2.147.483.648 x 9,223.372.036.854.775.808 Exabytes = 19.807,040.628.566.084.398.385.987.584 Yottabytes
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptionActivate current database instance on current thread.intaddBlobCluster(String iClusterName, Object... iParameters) Adds a new cluster for store blobs.intaddCluster(String iClusterName, int iRequestedId) Adds a new cluster.intaddCluster(String iClusterName, Object... iParameters) Adds a new cluster.begin()Begins a new transaction.begin(OTransaction.TXTYPE iStatus) Begins a new transaction specifying the transaction type.voidclose()Closes an opened database, if the database is already closed does nothing, if a transaction is active will be rollback.default OResultSetExecutes a generic (idempotent or non idempotent) command.default OResultSetExecutes a generic (idempotent or non idempotent) command.commit()Commits the current transaction.commit(boolean force) longcountClusterElements(int iCurrentClusterId) Counts all the entities in the specified cluster id.longcountClusterElements(int[] iClusterIds) Counts all the entities in the specified cluster ids.longcountClusterElements(String iClusterName) Counts all the entities in the specified cluster name.default OClasscreateClass(String className, String... superclasses) Creates a new class in the schemaDeletes the entity with the received RID from the database.Deletes the entity with the received RID from the database.Deletes an entity from the database in synchronous mode.booleandropCluster(int iClusterId) Drops a cluster by its id.booleandropCluster(String iClusterName) Drops a cluster by its name.default OResultSetExecute a script in a specified query language.default OResultSetExecute a script of a specified query language The result set has to be closed after usage
Sample usage:default <RET> RETexecuteWithRetry(int nRetries, Function<ODatabaseSession, RET> function) Tries to execute a lambda in a transaction, retrying it if an ONeedRetryException is thrown.booleanexistsCluster(String iClusterName) Returns true if the cluster exists, otherwise false.voidfreeze()Flush cached storage content to the disk.voidfreeze(boolean throwException) Flush cached storage content to the disk.get(ODatabase.ATTRIBUTES iAttribute) Returns a database attribute valueRetrieve the set of defined blob cluster.default OClassretrieves a class from the schemaintgetClusterIdByName(String iClusterName) Returns the cluster id by name.getClusterNameById(int iClusterId) Returns the cluster name by id.Returns all the names of the clusters.longgetClusterRecordSizeById(int iClusterId) Deprecated.longgetClusterRecordSizeByName(String iClusterName) Deprecated.intReturns the number of clusters.Returns the database configuration settings.Deprecated.intReturns the default cluster id.Deprecated.Manual indexes are prohibited and will be removedgetHooks()Retrieves all the registered hooks.Retrieves all the registered listeners.Returns the level1 cache.Return the OMetadata instance.getName()Returns the database name.Deprecated.usegetConfiguration()instead if you use >=3.0 API.getProperty(String iName) Deprecated.usegetConfiguration()instead if you use >=3.0 API.getRecordMetadata(ORID rid) Deprecated.longgetSize()Returns the total size of the records in the database.Returns the current status of database.Return active transaction.getType()getURL()Returns the database URL.getUser()Returns the current user logged into the database.incrementalBackup(String path) Performs incremental backup of database content to the selected folder.booleanReturns true if the current database instance is active on current thread, otherwise false.booleanisClosed()Checks if the database is closed.live(String query, OLiveQueryResultListener listener, Object... args) Subscribe a query as a live query for future create/update event with the referred conditionslive(String query, OLiveQueryResultListener listener, Map<String, ?> args) Subscribe a query as a live query for future create/update event with the referred conditions<RET extends T>
RETLoads the entity by the Record ID.<RET extends T>
RETLoads the entity by the Record ID using a fetch plan.<RET extends T>
RETLoads the entity by the Record ID using a fetch plan and specifying if the cache must be ignored.<RET extends T>
RETLoads the entity and return it.<RET extends T>
RETLoads a record using a fetch plan.<RET extends T>
RETLoads a record using a fetch plan.<RET extends T>
RETPessimistic lock a record.<RET extends T>
RETPessimistic lock a record.<RET> RETCreates a new entity instance.default OResultSetExecutes an SQL query.default OResultSetExecutes an SQL query (idempotent).<DB extends ODatabase<?>>
DBregisterHook(ORecordHook iHookImpl) Registers a hook to listen all events for Records.<DB extends ODatabase<?>>
DBregisterHook(ORecordHook iHookImpl, ORecordHook.HOOK_POSITION iPosition) voidregisterListener(ODatabaseListener iListener) Deprecated.voidrelease()Allows to execute write-related commands on DB.voidreload()Reloads the database information like the cluster list.<RET extends T>
RETForce the reloading of the entity.<RET extends T>
RETForce the reloading of the entity.rollback()Aborts the current running transaction.rollback(boolean force) <RET extends T>
RETSaves an entity in synchronous mode.<RET extends T>
RETSaves an entity in the specified cluster in synchronous mode.<DB extends ODatabase>
DBset(ODatabase.ATTRIBUTES iAttribute, Object iValue) Sets a database attribute value<DB extends ODatabase<?>>
DBsetConflictStrategy(ORecordConflictStrategy iResolver) Deprecated.<DB extends ODatabase<?>>
DBsetConflictStrategy(String iStrategyName) Deprecated.setProperty(String iName, Object iValue) Deprecated.useOrientDBConfig.builder().setConfig(propertyName, propertyValue).build();instead if you use >=3.0 API.<DB extends ODatabase>
DBsetStatus(ODatabase.STATUS iStatus) Deprecated.voidtruncateCluster(String clusterName) Removes all data in the cluster with given name.voidPessimistic unlock<DB extends ODatabase<?>>
DBunregisterHook(ORecordHook iHookImpl) Unregisters a previously registered hook.voidunregisterListener(ODatabaseListener iListener) Deprecated.Methods inherited from interface com.orientechnologies.orient.core.util.OBackupable
backup, restore
-
Method Details
-
activateOnCurrentThread
ODatabase activateOnCurrentThread()Activate current database instance on current thread. Call this method before using the database if you switch between multiple databases instances on the same thread or if you pass them across threads. -
isActiveOnCurrentThread
boolean isActiveOnCurrentThread()Returns true if the current database instance is active on current thread, otherwise false. -
reload
void reload()Reloads the database information like the cluster list. -
getConfiguration
OContextConfiguration getConfiguration()Returns the database configuration settings. If defined, any database configuration overwrites the global one.- Returns:
- OContextConfiguration
-
close
void close()Closes an opened database, if the database is already closed does nothing, if a transaction is active will be rollback.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getStatus
ODatabase.STATUS getStatus()Returns the current status of database. -
setStatus
Deprecated.Set the current status of database. deprecated since 2.2 -
getSize
long getSize()Returns the total size of the records in the database. -
getName
String getName()Returns the database name.- Returns:
- Name of the database
-
getURL
String getURL()Returns the database URL.- Returns:
- URL of the database
-
getLocalCache
OLocalRecordCache getLocalCache()Returns the level1 cache. Cannot be null.- Returns:
- Current cache.
-
getDefaultClusterId
int getDefaultClusterId()Returns the default cluster id. If not specified all the new entities will be stored in the default cluster.- Returns:
- The default cluster id
-
getClusters
int getClusters()Returns the number of clusters.- Returns:
- Number of the clusters
-
existsCluster
Returns true if the cluster exists, otherwise false.- Parameters:
iClusterName- Cluster name- Returns:
- true if the cluster exists, otherwise false
-
getClusterNames
Collection<String> getClusterNames()Returns all the names of the clusters.- Returns:
- Collection of cluster names.
-
getClusterIdByName
Returns the cluster id by name.- Parameters:
iClusterName- Cluster name- Returns:
- The id of searched cluster.
-
getClusterNameById
Returns the cluster name by id.- Parameters:
iClusterId- Cluster id- Returns:
- The name of searched cluster.
-
getClusterRecordSizeByName
Deprecated.Returns the total size of records contained in the cluster defined by its name.- Parameters:
iClusterName- Cluster name- Returns:
- Total size of records contained.
-
getClusterRecordSizeById
Deprecated.Returns the total size of records contained in the cluster defined by its id.- Parameters:
iClusterId- Cluster id- Returns:
- The name of searched cluster.
-
isClosed
boolean isClosed()Checks if the database is closed.- Returns:
- true if is closed, otherwise false.
-
truncateCluster
Removes all data in the cluster with given name. As result indexes for this class will be rebuilt.- Parameters:
clusterName- Name of cluster to be truncated.
-
countClusterElements
long countClusterElements(int iCurrentClusterId) Counts all the entities in the specified cluster id.- Parameters:
iCurrentClusterId- Cluster id- Returns:
- Total number of entities contained in the specified cluster
-
countClusterElements
long countClusterElements(int[] iClusterIds) Counts all the entities in the specified cluster ids.- Parameters:
iClusterIds- Array of cluster ids Cluster id- Returns:
- Total number of entities contained in the specified clusters
-
countClusterElements
Counts all the entities in the specified cluster name.- Parameters:
iClusterName- Cluster name- Returns:
- Total number of entities contained in the specified cluster
-
addCluster
Adds a new cluster.- Parameters:
iClusterName- Cluster nameiParameters- Additional parameters to pass to the factories- Returns:
- Cluster id
-
addBlobCluster
Adds a new cluster for store blobs.- Parameters:
iClusterName- Cluster nameiParameters- Additional parameters to pass to the factories- Returns:
- Cluster id
-
getBlobClusterIds
Retrieve the set of defined blob cluster.- Returns:
- the set of defined blob cluster ids.
-
addCluster
Adds a new cluster.- Parameters:
iClusterName- Cluster nameiRequestedId- requested id of the cluster- Returns:
- Cluster id
-
dropCluster
Drops a cluster by its name. Physical clusters will be completely deleted- Parameters:
iClusterName- the name of the cluster- Returns:
- true if has been removed, otherwise false
-
dropCluster
boolean dropCluster(int iClusterId) Drops a cluster by its id. Physical clusters will be completely deleted.- Parameters:
iClusterId- id of cluster to delete- Returns:
- true if has been removed, otherwise false
-
setProperty
Deprecated.useOrientDBConfig.builder().setConfig(propertyName, propertyValue).build();instead if you use >=3.0 API.Sets a property value- Parameters:
iName- Property nameiValue- new value to set- Returns:
- The previous value if any, otherwise null
-
getProperty
Deprecated.usegetConfiguration()instead if you use >=3.0 API.Gets the property value.- Parameters:
iName- Property name- Returns:
- The previous value if any, otherwise null
-
getProperties
Deprecated.usegetConfiguration()instead if you use >=3.0 API.Returns an iterator of the property entries -
get
Returns a database attribute value- Parameters:
iAttribute- Attributes between #ATTRIBUTES enum- Returns:
- The attribute value
-
set
Sets a database attribute value- Parameters:
iAttribute- Attributes between #ATTRIBUTES enumiValue- Value to set- Returns:
- underlying
-
registerListener
Deprecated.Registers a listener to the database events.- Parameters:
iListener- the listener to register
-
unregisterListener
Deprecated.Unregisters a listener to the database events.- Parameters:
iListener- the listener to unregister
-
getRecordMetadata
Deprecated. -
freeze
void freeze()Flush cached storage content to the disk.After this call users can perform only idempotent calls like read records and select/traverse queries. All write-related operations will queued till
release()command will be called.Given command waits till all on going modifications in indexes or DB will be finished.
IMPORTANT: This command is not reentrant.
- See Also:
-
release
void release()Allows to execute write-related commands on DB. Called afterfreeze()command.- See Also:
-
freeze
void freeze(boolean throwException) Flush cached storage content to the disk.After this call users can perform only select queries. All write-related commands will queued till
release()command will be called or exception will be thrown on attempt to modify DB data. Concrete behaviour depends onthrowExceptionparameter.IMPORTANT: This command is not reentrant.
- Parameters:
throwException- IftrueOModificationOperationProhibitedExceptionexception will be thrown in case of write command will be performed.
-
newInstance
<RET> RET newInstance()Creates a new entity instance.- Returns:
- The new instance.
-
getDictionary
Deprecated.Manual indexes are prohibited and will be removedReturns the Dictionary manual index.- Returns:
- ODictionary instance
-
getUser
OSecurityUser getUser()Returns the current user logged into the database.- See Also:
-
getClass
retrieves a class from the schema- Parameters:
className- The class name- Returns:
- The object representing the class in the schema. Null if the class does not exist.
-
createClass
Creates a new class in the schema- Parameters:
className- the class namesuperclasses- a list of superclasses for the class (can be empty)- Returns:
- the class with the given name
- Throws:
OSchemaException- if a class with this name already exists or if one of the superclasses does not exist.
-
load
Loads the entity and return it.- Parameters:
iObject- The entity to load. If the entity was already loaded it will be reloaded and all the changes will be lost.- Returns:
-
load
Loads a record using a fetch plan.- Parameters:
iObject- Record to loadiFetchPlan- Fetch plan used- Returns:
- The record received
-
lock
Pessimistic lock a record.In case of lock inside the transaction the lock will be release by the commit operation, In case of lock outside a transaction unlock need to be call manually.
- Parameters:
recordId- the id of the record that need to be locked- Returns:
- the record updated to the last state after the lock.
- Throws:
OLockException- In case of deadlock detected
-
lock
Pessimistic lock a record.- Parameters:
recordId- the id of the record that need to be lockedtimeout- for the record lockingtimeoutUnit- relative for the timeout- Returns:
- the record updated to the last state after the lock.
- Throws:
OLockException- In case of deadlock detected
-
unlock
Pessimistic unlock- Parameters:
recordId- the id of the record to unlock- Throws:
OLockException- if the record is not locked.
-
load
Loads a record using a fetch plan.- Parameters:
iObject- Record to loadiFetchPlan- Fetch plan usediIgnoreCache- Ignore cache or use it- Returns:
- The record received
-
reload
Force the reloading of the entity.- Parameters:
iObject- The entity to load. If the entity was already loaded it will be reloaded and all the changes will be lost.iFetchPlan- Fetch plan usediIgnoreCache- Ignore cache or use it- Returns:
- The loaded entity
-
reload
Force the reloading of the entity.- Parameters:
iObject- The entity to load. If the entity was already loaded it will be reloaded and all the changes will be lost.iFetchPlan- Fetch plan usediIgnoreCache- Ignore cache or use itforce- Force to reload record even if storage has the same record as reloaded record, it is useful if fetch plan is not null and alongside with root record linked records will be reloaded.- Returns:
- The loaded entity
-
load
Loads the entity by the Record ID.- Parameters:
recordId- The unique record id of the entity to load.- Returns:
- The loaded entity
-
load
Loads the entity by the Record ID using a fetch plan.- Parameters:
iRecordId- The unique record id of the entity to load.iFetchPlan- Fetch plan used- Returns:
- The loaded entity
-
load
Loads the entity by the Record ID using a fetch plan and specifying if the cache must be ignored.- Parameters:
iRecordId- The unique record id of the entity to load.iFetchPlan- Fetch plan usediIgnoreCache- Ignore cache or use it- Returns:
- The loaded entity
-
save
Saves an entity in synchronous mode. If the entity is not dirty, then the operation will be ignored. For custom entity implementations assure to set the entity as dirty.- Parameters:
iObject- The entity to save- Returns:
- The saved entity.
-
save
Saves an entity in the specified cluster in synchronous mode. If the entity is not dirty, then the operation will be ignored. For custom entity implementations assure to set the entity as dirty. If the cluster does not exist, an error will be thrown.- Parameters:
iObject- The entity to saveiClusterName- Name of the cluster where to save- Returns:
- The saved entity.
-
delete
Deletes an entity from the database in synchronous mode.- Parameters:
iObject- The entity to delete.- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
delete
Deletes the entity with the received RID from the database.- Parameters:
iRID- The RecordID to delete.- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
delete
Deletes the entity with the received RID from the database.- Parameters:
iRID- The RecordID to delete.iVersion- for MVCC- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
getTransaction
OTransaction getTransaction()Return active transaction. Cannot be null. If no transaction is active, then a OTransactionNoTx instance is returned.- Returns:
- OTransaction implementation
-
begin
Begins a new transaction. By default the type is OPTIMISTIC. If a previous transaction is running a nested call counter is incremented. A transaction once begun has to be closed by calling thecommit()orrollback().- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
begin
Begins a new transaction specifying the transaction type. If a previous transaction is running a nested call counter is incremented. A transaction once begun has to be closed by calling thecommit()orrollback().- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
commit
Commits the current transaction. The approach is all or nothing. All changes will be permanent following the storage type. If the operation succeed all the entities changed inside the transaction context will be effective. If the operation fails, all the changed entities will be restored in the data store.- Returns:
- Throws:
OTransactionException
-
commit
- Throws:
OTransactionException
-
rollback
Aborts the current running transaction. All the pending changed entities will be restored in the data store.- Returns:
- Throws:
OTransactionException
-
rollback
- Throws:
OTransactionException
-
query
default OResultSet query(String query, Object... args) throws OCommandSQLParsingException, OCommandExecutionException Executes an SQL query. The result set has to be closed after usage
Sample usage:OResultSet rs = db.query("SELECT FROM V where name = ?", "John"); while(rs.hasNext()){ OResult item = rs.next(); ... } rs.close();- Parameters:
query- the query stringargs- query parameters (positional)- Returns:
- the query result set
- Throws:
OCommandSQLParsingExceptionOCommandExecutionException
-
query
default OResultSet query(String query, Map args) throws OCommandSQLParsingException, OCommandExecutionException Executes an SQL query (idempotent). The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("SELECT FROM V where name = :name", params); while(rs.hasNext()){ OResult item = rs.next(); ... } rs.close();- Parameters:
query- the query stringargs- query parameters (named)- Returns:
- Throws:
OCommandSQLParsingExceptionOCommandExecutionException
-
command
default OResultSet command(String query, Object... args) throws OCommandSQLParsingException, OCommandExecutionException Executes a generic (idempotent or non idempotent) command. The result set has to be closed after usage
Sample usage:OResultSet rs = db.command("INSERT INTO Person SET name = ?", "John"); ... rs.close();- Parameters:
query-args- query arguments- Returns:
- Throws:
OCommandSQLParsingExceptionOCommandExecutionException
-
command
default OResultSet command(String query, Map args) throws OCommandSQLParsingException, OCommandExecutionException Executes a generic (idempotent or non idempotent) command. The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("INSERT INTO Person SET name = :name", params); ... rs.close();- Parameters:
query-args-- Returns:
- Throws:
OCommandSQLParsingExceptionOCommandExecutionException
-
execute
default OResultSet execute(String language, String script, Object... args) throws OCommandExecutionException, OCommandScriptException Execute a script in a specified query language. The result set has to be closed after usage
Sample usage:String script = "INSERT INTO Person SET name = 'foo', surname = ?;"+ "INSERT INTO Person SET name = 'bar', surname = ?;"+ "INSERT INTO Person SET name = 'baz', surname = ?;";OResultSet rs = db.execute("sql", script, "Surname1", "Surname2", "Surname3"); ... rs.close();
- Parameters:
language-script-args-- Returns:
- Throws:
OCommandExecutionExceptionOCommandScriptException
-
execute
default OResultSet execute(String language, String script, Map<String, ?> args) throws OCommandExecutionException, OCommandScriptExceptionExecute a script of a specified query language The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("surname1", "Jones"); params.put("surname2", "May"); params.put("surname3", "Ali");String script = "INSERT INTO Person SET name = 'foo', surname = :surname1;"+ "INSERT INTO Person SET name = 'bar', surname = :surname2;"+ "INSERT INTO Person SET name = 'baz', surname = :surname3;";
OResultSet rs = db.execute("sql", script, params); ... rs.close();
- Parameters:
language-script-args-- Returns:
- Throws:
OCommandExecutionExceptionOCommandScriptException
-
getMetadata
OMetadata getMetadata()Return the OMetadata instance. Cannot be null.- Returns:
- The OMetadata instance.
-
registerHook
Registers a hook to listen all events for Records.- Parameters:
iHookImpl- ORecordHook implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
registerHook
<DB extends ODatabase<?>> DB registerHook(ORecordHook iHookImpl, ORecordHook.HOOK_POSITION iPosition) -
getHooks
Map<ORecordHook,ORecordHook.HOOK_POSITION> getHooks()Retrieves all the registered hooks.- Returns:
- A not-null unmodifiable map of ORecordHook and position instances. If there are no hooks registered, the Map is empty.
-
unregisterHook
Unregisters a previously registered hook.- Parameters:
iHookImpl- ORecordHook implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain. deprecated since 2.2
-
getListeners
Iterable<ODatabaseListener> getListeners()Retrieves all the registered listeners.- Returns:
- An iterable of ODatabaseListener instances.
-
getType
String getType() -
getConflictStrategy
Deprecated.Returns the current record conflict strategy. -
setConflictStrategy
Deprecated.Overrides record conflict strategy selecting the strategy by name.- Parameters:
iStrategyName- ORecordConflictStrategy strategy name- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
setConflictStrategy
Deprecated.Overrides record conflict strategy.- Parameters:
iResolver- ORecordConflictStrategy implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
incrementalBackup
Performs incremental backup of database content to the selected folder. This is thread safe operation and can be done in normal operational mode.If it will be first backup of data full content of database will be copied into folder otherwise only changes after last backup in the same folder will be copied.
- Parameters:
path- Path to backup folder.- Returns:
- File name of the backup
- Throws:
UnsupportedOperationException- Since:
- 2.2
-
live
Subscribe a query as a live query for future create/update event with the referred conditions- Parameters:
query- live querylistener- the listener that receive the query resultsargs- the live query args
-
live
Subscribe a query as a live query for future create/update event with the referred conditions- Parameters:
query- live querylistener- the listener that receive the query resultsargs- the live query args
-
executeWithRetry
default <RET> RET executeWithRetry(int nRetries, Function<ODatabaseSession, RET> function) throws IllegalStateException, IllegalArgumentException, ONeedRetryException, UnsupportedOperationExceptionTries to execute a lambda in a transaction, retrying it if an ONeedRetryException is thrown.If the DB does not have an active transaction, after the execution you will still be out of tx.
If the DB has an active transaction, then the transaction has to be empty (no operations executed yet) and after the execution you will be in a new transaction.
- Type Parameters:
RET- the return type of the lambda- Parameters:
nRetries- the maximum number of retries (> 0)function- a lambda containing application code to execute in a commit/retry loop- Returns:
- The result of the execution of the lambda
- Throws:
IllegalStateException- if there are operations in the current transactionONeedRetryException- if the maximum number of retries is executed and all failed with an ONeedRetryExceptionIllegalArgumentException- if nRetries is <= 0UnsupportedOperationException- if this type of database does not support automatic commit/retry
-