📄 toplinkoperations.java
字号:
Object readAndCopy(Class entityClass, Object[] keys, boolean enforceReadOnly) throws DataAccessException;
//-------------------------------------------------------------------------
// Convenience methods for copying and refreshing objects
//-------------------------------------------------------------------------
/**
* Create a detached copy of the given entity object,
* using TopLink's default ObjectCopyingPolicy.
* @param entity the entity object to copy
* @return the copy of the entity object
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#copyObject(Object)
*/
Object copy(Object entity) throws DataAccessException;
/**
* Create a detached copy of the given entity object.
* @param entity the entity object to copy
* @param copyingPolicy the TopLink ObjectCopyingPolicy to apply
* @return the copy of the entity object
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#copyObject(Object, oracle.toplink.sessions.ObjectCopyingPolicy)
*/
Object copy(Object entity, ObjectCopyingPolicy copyingPolicy) throws DataAccessException;
/**
* Create detached copies of all given entity objects,
* using TopLink's default ObjectCopyingPolicy.
* @param entities the entity objects to copy
* @return the copies of the entity objects
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#copyObject(Object)
*/
List copyAll(Collection entities) throws DataAccessException;
/**
* Create detached copies of all given entity objects.
* @param entities the entity objects to copy
* @param copyingPolicy the TopLink ObjectCopyingPolicy to apply
* @return the copies of the entity objects
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#copyObject(Object)
*/
List copyAll(Collection entities, ObjectCopyingPolicy copyingPolicy) throws DataAccessException;
/**
* Refresh the given entity object, returning the refreshed object.
* <p>The returned object will only be different from the passed-in object
* if the passed-in object is not the currently registered version of
* the corresponding entity.
* <p>Retrieves read-write objects from the TopLink UnitOfWork in case of a
* non-read-only transaction, and read-only objects else.
* @param entity the entity object to refresh
* @return the refreshed version of the entity object
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#refreshObject(Object)
*/
Object refresh(Object entity) throws DataAccessException;
/**
* Refresh the given entity object, returning the refreshed object.
* <p>The returned object will only be different from the passed-in object
* if the passed-in object is not the currently registered version of
* the corresponding entity.
* <p>Retrieves read-write objects from the TopLink UnitOfWork in case of a
* non-read-only transaction, and read-only objects else.
* @param entity the entity object to refresh
* @param enforceReadOnly whether to always retrieve read-only objects from
* the plain TopLink Session (else, read-write objects will be retrieved
* from the TopLink UnitOfWork in case of a non-read-only transaction)
* @return the refreshed version of the entity object
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#refreshObject(Object)
*/
Object refresh(Object entity, boolean enforceReadOnly) throws DataAccessException;
/**
* Refresh the given entity objects, returning the corresponding refreshed objects.
* <p>A returned object will only be different from the corresponding passed-in
* object if the passed-in object is not the currently registered version of
* the corresponding entity.
* <p>Retrieves read-write objects from the TopLink UnitOfWork in case of a
* non-read-only transaction, and read-only objects else.
* @param entities the entity objects to refresh
* @return the refreshed versions of the entity objects
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#refreshObject(Object)
*/
List refreshAll(Collection entities) throws DataAccessException;
/**
* Refresh the given entity objects, returning the corresponding refreshed objects.
* <p>A returned object will only be different from the corresponding passed-in
* object if the passed-in object is not the currently registered version of
* the corresponding entity.
* @param entities the entity objects to refresh
* @param enforceReadOnly whether to always retrieve read-only objects from
* the plain TopLink Session (else, read-write objects will be retrieved
* from the TopLink UnitOfWork in case of a non-read-only transaction)
* @return the refreshed versions of the entity objects
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.Session#refreshObject(Object)
*/
List refreshAll(Collection entities, boolean enforceReadOnly) throws DataAccessException;
//-------------------------------------------------------------------------
// Convenience methods for persisting and deleting objects
//-------------------------------------------------------------------------
/**
* Register the given (new or existing) entity with the current UnitOfWork.
* <p>The entity will be checked for existence, according to TopLink's
* configured existence checking policy. To avoid the (potentially costly)
* existence check, consider using the specific <code>registerNew</code>
* or <code>registerExisting</code> method.
* <b>Do not edit the passed-in object any further afterwards.</b>
* @param entity the entity to register
* @return the registered clone of the original object,
* which needs to be used for further editing
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#registerObject(Object)
* @see #registerNew(Object)
* @see #registerExisting(Object)
*/
Object register(Object entity);
/**
* Register all given entities with the current UnitOfWork.
* <b>Do not edit the passed-in objects any further afterwards.</b>
* @param entities the entities to register
* @return the registered clones of the original objects,
* which need to be used for further editing
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#registerAllObjects(java.util.Collection)
*/
List registerAll(Collection entities);
/**
* Register the given new entity with the current UnitOfWork.
* The passed-in object can be edited further afterwards.
* @param entity the new entity to register
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#registerNewObject(Object)
*/
void registerNew(Object entity);
/**
* Register the given existing entity with the current UnitOfWork.
* <b>Do not edit the passed-in object any further afterwards.</b>
* @param entity the existing entity to register
* @return the registered clone of the original object,
* which needs to be used for further editing
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#registerExistingObject(Object)
*/
Object registerExisting(Object entity);
/**
* Reassociate the given entity copy with the current UnitOfWork,
* using simple merging.
* <p>The given object will not be reassociated itself: instead, the state
* will be copied onto the persistent object with the same identifier.
* In case of a new entity, merge will copy to a registered object as well,
* but will also update the identifier of the passed-in object.
* @param entity the updated copy to merge
* @return the updated, registered persistent instance
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#mergeClone(Object)
*/
Object merge(Object entity) throws DataAccessException;
/**
* Reassociate the given entity copy with the current UnitOfWork,
* using deep merging of all contained entities.
* <p>The given object will not be reassociated itself: instead, the state
* will be copied onto the persistent object with the same identifier.
* In case of a new entity, merge will register a copy as well,
* but will also update the identifier of the passed-in object.
* @param entity the updated copy to merge
* @return the updated, registered persistent instance
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#deepMergeClone(Object)
*/
Object deepMerge(Object entity) throws DataAccessException;
/**
* Reassociate the given entity copy with the current UnitOfWork,
* using shallow merging of the entity instance.
* <p>The given object will not be reassociated itself: instead, the state
* will be copied onto the persistent object with the same identifier.
* In case of a new entity, merge will register a copy as well,
* but will also update the identifier of the passed-in object.
* @param entity the updated copy to merge
* @return the updated, registered persistent instance
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#shallowMergeClone(Object)
*/
Object shallowMerge(Object entity) throws DataAccessException;
/**
* Reassociate the given entity copy with the current UnitOfWork,
* using merging with all references from this clone.
* <p>The given object will not be reassociated itself: instead, the state
* will be copied onto the persistent object with the same identifier.
* In case of a new entity, merge will register a copy as well,
* but will also update the identifier of the passed-in object.
* @param entity the updated copy to merge
* @return the updated, registered persistent instance
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#mergeCloneWithReferences(Object)
*/
Object mergeWithReferences(Object entity) throws DataAccessException;
/**
* Delete the given entity.
* @param entity the entity to delete
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#deleteObject(Object)
*/
void delete(Object entity) throws DataAccessException;
/**
* Delete all given entities.
* @param entities the entities to delete
* @throws org.springframework.dao.DataAccessException in case of TopLink errors
* @see oracle.toplink.sessions.UnitOfWork#deleteAllObjects(java.util.Collection)
*/
void deleteAll(Collection entities) throws DataAccessException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -