public interface ODatabaseObject extends ODatabase<Object>, OUserObject2RecordHandler
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUS
Modifier and Type | Method and Description |
---|---|
<RET> OObjectIteratorClassInterface<RET> |
browseClass(Class<RET> iClusterClass)
Browses all the records of the specified class.
|
<RET> OObjectIteratorClusterInterface<RET> |
browseCluster(String iClusterName)
Browses all the records of the specified cluster.
|
long |
countClass(String iClassName)
Counts the entities contained in the specified class and sub classes (polymorphic).
|
long |
countClass(String iClassName,
boolean iPolymorphic)
Counts the entities contained in the specified class.
|
<RET> RET |
detach(Object iPojo)
Method that detaches all fields contained in the document to the given object.
|
<RET> RET |
detach(Object iPojo,
boolean returnNonProxiedInstance)
Method that detaches all fields contained in the document to the given object.
|
default <RET> RET |
detachAll(Object iPojo)
Method that detaches all fields contained in the document to the given object and recursively
all object tree.
|
<RET> RET |
detachAll(Object iPojo,
boolean returnNonProxiedInstance)
Method that detaches all fields contained in the document to the given object and recursively
all object tree.
|
default <T> T |
executeWithRetry(int nRetries,
Function<ODatabaseSession,T> function)
Tries to execute a lambda in a transaction, retrying it if an ONeedRetryException is thrown.
|
OEntityManager |
getEntityManager()
Returns the entity manager that handle the binding from ODocuments and POJOs.
|
OMetadataObject |
getMetadata()
Return the OMetadata instance.
|
boolean |
isLazyLoading() |
boolean |
isRetainObjects() |
<T> T |
newInstance(Class<T> iType)
Creates a new entity of the specified class.
|
<RET> RET |
newInstance(String iClassName)
Creates a new entity instance.
|
<RET extends List<?>> |
objectCommand(String iCommand,
Map<String,Object> iArgs) |
<RET extends List<?>> |
objectCommand(String iCommand,
Object... iArgs) |
<RET extends List<?>> |
objectQuery(String iCommand,
Map<String,Object> iArgs) |
<RET extends List<?>> |
objectQuery(String iCommand,
Object... iArgs) |
ODocument |
pojo2Stream(Object iPojo,
ODocument iRecord) |
void |
setDirty(Object iPojo)
Sets as dirty a POJO.
|
void |
setLazyLoading(boolean lazyLoading) |
ODatabase |
setRetainObjects(boolean iRetainObjects) |
Object |
stream2pojo(ODocument iRecord,
Object iPojo,
String iFetchPlan) |
void |
unsetDirty(Object iPojo)
Sets as not dirty a POJO.
|
activateOnCurrentThread, addBlobCluster, addCluster, addCluster, begin, begin, begin, close, command, command, command, commit, commit, countClusterElements, countClusterElements, countClusterElements, countClusterElements, countClusterElements, create, create, create, createClass, declareIntent, delete, delete, delete, drop, dropCluster, dropCluster, execute, execute, exists, existsCluster, freeze, freeze, get, getActiveIntent, getBlobClusterIds, getClass, getClusterIdByName, getClusterNameById, getClusterNames, getClusterRecordSizeById, getClusterRecordSizeByName, getClusters, getConfiguration, getConflictStrategy, getDefaultClusterId, getDictionary, getHooks, getListeners, getLocalCache, getName, getProperties, getProperty, getRecordMetadata, getSize, getStatus, getTransaction, getType, getURL, getUser, incrementalBackup, isActiveOnCurrentThread, isClosed, isMVCC, live, live, load, load, load, load, load, load, lock, lock, newInstance, open, query, query, query, registerHook, registerHook, registerListener, release, reload, reload, reload, rollback, rollback, save, save, save, save, set, setConflictStrategy, setConflictStrategy, setMVCC, setProperty, setStatus, truncateCluster, unlock, unregisterHook, unregisterListener
backup, restore
existsUserObjectByRID, getRecordByUserObject, getUserObjectByRecord, registerUserObject, registerUserObjectAfterLinkSave
void setDirty(Object iPojo)
iPojo
- User objectvoid unsetDirty(Object iPojo)
iPojo
- User object<RET> OObjectIteratorClusterInterface<RET> browseCluster(String iClusterName)
iClusterName
- Cluster name to iterate<RET> OObjectIteratorClassInterface<RET> browseClass(Class<RET> iClusterClass)
iClusterClass
- Class name to iterate<RET> RET newInstance(String iClassName)
long countClass(String iClassName)
iClassName
- Class namelong countClass(String iClassName, boolean iPolymorphic)
iClassName
- Class nameiPolymorphic
- True if consider also the sub classes, otherwise false<T> T newInstance(Class<T> iType)
iType
- Class name where to originate the instanceOEntityManager getEntityManager()
<RET> RET detach(Object iPojo)
OObjectEntitySerializer.detach(T, ODatabaseObject)
iPojo
- :- the object to detach<RET> RET detach(Object iPojo, boolean returnNonProxiedInstance)
RET
- iPojo
- :- the object to detachreturnNonProxiedInstance
- :- defines if the return object will be a proxied instance or
not. If set to TRUE and the object does not contains @Id and @Version fields it could
procude data replicationdefault <RET> RET detachAll(Object iPojo)
StackOverflowError
with big objects tree. To avoid it
set the stack size with -Xss java optionRET
- iPojo
- :- the objects to detach<RET> RET detachAll(Object iPojo, boolean returnNonProxiedInstance)
StackOverflowError
with big objects tree. To avoid it
set the stack size with -Xss java optionRET
- iPojo
- :- the objects to detachreturnNonProxiedInstance
- :- defines if the return object will be a proxied instance or
not. If set to TRUE and the object does not contains @Id and @Version fields it could
procude data replicationboolean isRetainObjects()
ODatabase setRetainObjects(boolean iRetainObjects)
boolean isLazyLoading()
void setLazyLoading(boolean lazyLoading)
OMetadataObject getMetadata()
ODatabase
getMetadata
in interface ODatabase<Object>
default <T> T executeWithRetry(int nRetries, Function<ODatabaseSession,T> function) throws IllegalStateException, IllegalArgumentException, ONeedRetryException, UnsupportedOperationException
ODatabase
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.
executeWithRetry
in interface ODatabase<Object>
T
- the return type of the lambdanRetries
- the maximum number of retries (> 0)function
- a lambda containing application code to execute in a commit/retry loopIllegalStateException
- if there are operations in the current transactionIllegalArgumentException
- if nRetries is <= 0ONeedRetryException
- if the maximum number of retries is executed and all failed with an
ONeedRetryExceptionUnsupportedOperationException
- if this type of database does not support automatic
commit/retryCopyright © 2009–2020 OrientDB. All rights reserved.