public interface DatabaseSession extends Session
Purpose: Add login and configuration API to that of Session. This interface is to be used during the creation and login of the session only. The Session interface should be used after login for normal reading/writing.
Modifier and Type | Method and Description |
---|---|
void |
addDescriptor(ClassDescriptor descriptor)
PUBLIC:
Add the descriptor to the session.
|
void |
addDescriptors(java.util.Collection descriptors)
PUBLIC:
Add the descriptors to the session.
|
void |
addDescriptors(Project project)
PUBLIC:
Add the descriptors to the session from the Project.
|
void |
addSequence(Sequence sequence)
PUBLIC:
Add the sequence to the session.
|
void |
beginTransaction()
PUBLIC:
Begin a transaction on the database.
|
void |
commitTransaction()
PUBLIC:
Commit the active database transaction.
|
void |
deleteAllObjects(java.util.Collection domainObjects)
PUBLIC:
delete all of the objects and all of their privately owned parts in the database.
|
java.lang.Object |
deleteObject(java.lang.Object domainObject)
PUBLIC:
Delete the object and all of its privately owned parts from the database.
|
CommandManager |
getCommandManager()
ADVANCED:
Return the CommandManager that allows this session to act as a
CommandProcessor and receive or propagate commands from/to the
EclipseLink cluster.
|
DatabaseEventListener |
getDatabaseEventListener()
Return the database event listener, this allows database events to invalidate the cache.
|
SequencingControl |
getSequencingControl()
PUBLIC:
Return SequencingControl which used for sequencing setup and
customization including management of sequencing preallocation.
|
ServerPlatform |
getServerPlatform()
PUBLIC:
Answer the server platform defining server-specific behavior for the receiver (Oc4j, WLS, ...).
|
java.lang.Object |
insertObject(java.lang.Object domainObject)
PUBLIC:
Insert the object and all of its privately owned parts into the database.
|
boolean |
isInTransaction()
PUBLIC:
Return if the session is currently in the progress of a database transaction.
|
void |
login()
PUBLIC:
Connect to the database using the predefined login.
|
void |
login(Login login)
PUBLIC:
Connect to the database using the given login.
|
void |
login(java.lang.String userName,
java.lang.String password)
PUBLIC:
Connect to the database using the given user name and password.
|
void |
logout()
PUBLIC:
Disconnect from the database.
|
java.lang.Object |
refreshAndLockObject(java.lang.Object object)
PUBLIC:
Refresh the attributes of the object and of all of its private parts from the database.
|
java.lang.Object |
refreshAndLockObject(java.lang.Object object,
short lockMode)
PUBLIC:
Refresh the attributes of the object and of all of its private parts from the database.
|
void |
rollbackTransaction()
PUBLIC:
Rollback the active database transaction.
|
void |
setCommandManager(CommandManager commandManager)
ADVANCED:
Set the CommandManager that allows this session to act as a
CommandProcessor and receive or propagate commands from/to the
EclipseLink cluster.
|
void |
setDatabaseEventListener(DatabaseEventListener databaseEventListener)
PUBLIC:
Set the database event listener, this allows database events to invalidate the cache.
|
void |
setDatasourceLogin(Login login)
PUBLIC:
Set the login.
|
void |
setExternalTransactionController(ExternalTransactionController etc)
PUBLIC:
Used for JTS integration.
|
void |
setLogin(Login login)
PUBLIC:
Set the login.
|
void |
setServerPlatform(ServerPlatform newServerPlatform)
PUBLIC:
Set the server platform defining server-specific behavior for the receiver (Oc4j, WLS, ... ).
|
void |
setShouldPropagateChanges(boolean choice)
ADVANCED:
Set if cache changes should be propagated to other sessions or applications
in a EclipseLink cluster through the Remote Command Manager mechanism.
|
boolean |
shouldPropagateChanges()
ADVANCED:
Return whether changes should be propagated to other sessions or applications
in a EclipseLink cluster through the Remote Command Manager mechanism.
|
java.lang.Object |
updateObject(java.lang.Object domainObject)
PUBLIC:
Update the object and all of its privately owned parts in the database.
|
void |
writeAllObjects(java.util.Collection domainObjects)
PUBLIC:
Write all of the objects and all of their privately owned parts in the database.
|
java.lang.Object |
writeObject(java.lang.Object domainObject)
PUBLIC:
Write the object and all of its privately owned parts in the database.
|
acquireHistoricalSession, acquireUnitOfWork, acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, containsQuery, copy, copy, copyObject, copyObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getAsOfClause, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDatasourcePlatform, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getId, getIdentityMapAccessor, getIntegrityChecker, getJPAQueries, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getPartitioningPolicy, getPlatform, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getSerializer, getSessionLog, handleException, handleSevere, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, isClientSession, isConnected, isDatabaseSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isUnitOfWork, keyFromObject, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, release, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setIntegrityChecker, setIsFinalizersEnabled, setLog, setLogLevel, setName, setPartitioningPolicy, setProfiler, setProperty, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setSerializer, setSessionLog, shouldLog, shouldLogMessages, validateCache
void addDescriptor(ClassDescriptor descriptor)
void addDescriptors(java.util.Collection descriptors)
void addSequence(Sequence sequence)
void addDescriptors(Project project)
void beginTransaction() throws DatabaseException
DatabaseException
- if the database connection is lost or the begin is rejected.isInTransaction()
void commitTransaction() throws DatabaseException
DatabaseException
- most databases validate changes as they are done,
normally errors do not occur on commit unless the disk fails or the connection is lost.ConcurrencyException
- if this session is not within a transaction.void deleteAllObjects(java.util.Collection domainObjects)
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database errors.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.java.lang.Object deleteObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
OptimisticLockException
DeleteObjectQuery
java.lang.Object insertObject(java.lang.Object domainObject) throws DatabaseException
DatabaseException
InsertObjectQuery
,
writeObject(Object)
boolean isInTransaction()
void setServerPlatform(ServerPlatform newServerPlatform)
ServerPlatformBase
ServerPlatform getServerPlatform()
getServerPlatform
in interface Session
ServerPlatformBase
SequencingControl getSequencingControl()
void login() throws DatabaseException
DatabaseException
login(Login)
void login(java.lang.String userName, java.lang.String password) throws DatabaseException
DatabaseException
void login(Login login) throws DatabaseException
DatabaseException
void logout() throws DatabaseException
EclipseLinkException
- if a transaction is active, you must rollback any active transaction before logout.DatabaseException
- the database will also raise an error if their is an active transaction,
or a general error occurs.java.lang.Object refreshAndLockObject(java.lang.Object object)
refreshAndLockObject(Object, short)
java.lang.Object refreshAndLockObject(java.lang.Object object, short lockMode)
Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT
void rollbackTransaction() throws DatabaseException
DatabaseException
- if the database connection is lost or the rollback fails.ConcurrencyException
- if this session is not within a transaction.void setExternalTransactionController(ExternalTransactionController etc)
setExternalTransactionController
in interface Session
JTATransactionController
,
CustomServerPlatform
CommandManager getCommandManager()
CommandManager
void setCommandManager(CommandManager commandManager)
commandManager
- The CommandManager instance to control the remote command
service for this session.setShouldPropagateChanges(boolean)
,
CommandManager
void setShouldPropagateChanges(boolean choice)
choice
- If true (and the CommandManager is set) then propagation will occur.setCommandManager(CommandManager)
boolean shouldPropagateChanges()
setCommandManager(CommandManager)
void setLogin(Login login)
void setDatasourceLogin(Login login)
java.lang.Object updateObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
OptimisticLockException
UpdateObjectQuery
,
writeObject(Object)
void writeAllObjects(java.util.Collection domainObjects)
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database errors.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.java.lang.Object writeObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
OptimisticLockException
WriteObjectQuery
,
insertObject(Object)
,
updateObject(Object)
DatabaseEventListener getDatabaseEventListener()
void setDatabaseEventListener(DatabaseEventListener databaseEventListener)