Class AbstractSession
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
-
- org.eclipse.persistence.internal.sessions.AbstractSession
-
- All Implemented Interfaces:
Serializable
,Cloneable
,CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
,CommandProcessor
,Session
- Direct Known Subclasses:
ClientSession
,DatabaseSessionImpl
,HistoricalSession
,UnitOfWorkImpl
public abstract class AbstractSession extends CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager> implements Session, CommandProcessor, Serializable, Cloneable
Implementation of org.eclipse.persistence.sessions.Session The public interface should be used.- See Also:
Purpose: Define the interface and common protocol of an EclipseLink compliant session. Description: The session is the primary interface into EclipseLink, the application should do all of its reading and writing of objects through the session. The session also manages transactions and units of work. Normally the session is passed and used by the application controller objects. Controller objects normally sit behind the GUI and perform the business processes required for the application, they should perform all explicit database access and database access should be avoided from the domain object model. Do not use a globally accessible session instance, doing so does not allow for multiple sessions. Multiple sessions may required when performing things like data migration or multiple database access, as well the unit of work feature requires the usage of multiple session instances. Although session is abstract, any users of its subclasses should only cast the variables to Session to allow usage of any of its subclasses. Responsibilities: Connecting/disconnecting. Reading and writing objects. Transaction and unit of work support. Identity maps and caching.
,DatabaseSessionImpl
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<Accessor>
accessors
The connection to the data store.protected ExposedNodeLinkedList
activeCommandThreads
List of active command threads.protected Map<String,AttributeGroup>
attributeGroups
Stores predefined reusable AttributeGroups.protected AbstractSession
broker
Support being owned by a session broker.protected CommandManager
commandManager
Used to connect this session to EclipseLink cluster for distributed commandprotected CommitManager
commitManager
Resolves referential integrity on commits.protected ReferenceMode
defaultReferenceMode
Stores the default reference mode that a UnitOfWork will use when referencing managed objects.protected List<DescriptorEvent>
deferredEvents
temporarily holds a list of events that must be fired after the current operation completes.protected Map<Class,ClassDescriptor>
descriptors
PERF: cache descriptors from project.protected SessionEventManager
eventManager
Stores the event listeners for this session.protected ExceptionHandler
exceptionHandler
ExceptionHandler handles database exceptions.protected ExternalTransactionController
externalTransactionController
Delegate that handles synchronizing a UnitOfWork with an external transaction.protected IdentityMapAccessor
identityMapAccessor
Manages the live object cache.protected InjectionManager
injectionManager
Allow CDI injection of entity listenersprotected IntegrityChecker
integrityChecker
IntegrityChecker catch all the descriptor Exceptions.protected boolean
isConcurrent
Allow a session to enable concurrent processing.protected boolean
isExecutingEvents
records that the UOW is executing deferred events.protected boolean
isFinalizersEnabled
PERF: Allow for finalizers to be enabled, currently enables client-session finalize.protected boolean
isInBroker
Used to determine If a session is in a Broker or notprotected boolean
isInProfile
Used to determine If a session is in a profile or notprotected boolean
isLoggingOff
PERF: Quick check if logging is OFF entirely.protected boolean
isSynchronized
Indicates whether the session is synchronized.protected boolean
jpaQueriesProcessed
Stores predefined not yet parsed JPQL queries.protected ClassDescriptor
lastDescriptorAccessed
Last descriptor accessed, use to optimize descriptor lookup.protected String
logSessionString
When logging the name of the session is typed: class name + system hashcode.protected MetadataRefreshListener
metadatalistener
the MetadataRefreshListener is used with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappersprotected Set<String>
multitenantContextProperties
Stores the set of multitenant context properties this session requiresprotected String
name
Used to identify a session when using the session broker.protected int
numberOfActiveUnitsOfWork
Keep track of active units of work.protected Map
objectsLockedForClone
This collection will be used to store those objects that are currently locked for the clone process.protected PartitioningPolicy
partitioningPolicy
Allow queries to be targeted at specific connection pools.protected Integer
pessimisticLockTimeoutDefault
Default pessimistic lock timeout value.protected TimeUnit
pessimisticLockTimeoutUnitDefault
protected Platform
platform
Allow the datasource platform to be cached.protected SessionProfiler
profiler
Tool that log performance information.protected Project
project
The project stores configuration information, such as the descriptors and login.protected Map<String,Object>
properties
Allow for user defined properties.protected Map<String,List<DatabaseQuery>>
queries
Stores predefine reusable queries.protected JPAQueryBuilder
queryBuilder
Store the query builder used to parse JPQL.protected int
queryTimeoutDefault
protected TimeUnit
queryTimeoutUnitDefault
protected Serializer
serializer
Set the Serializer to use by default for serialization.protected SessionLog
sessionLog
Destination for logged messages and SQL.protected boolean
shouldCheckWriteLock
PERF: Cache the write-lock check to avoid cost of checking in every register/clone.protected boolean
shouldOptimizeResultSetAccess
Indicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization.protected boolean
shouldPropagateChanges
Determined whether changes should be propagated to an EclipseLink clusterprotected Map<String,String>
staticMetamodelClasses
This map will hold onto class to static metamodel class references from JPA.protected List<ClassDescriptor>
tablePerTenantDescriptors
PERF: cache table per tenant descriptors needing to be initialized per EMprotected List<DatabaseQuery>
tablePerTenantQueries
PERF: cache table per tenant queries needing to be initialized per EMprotected boolean
tolerateInvalidJPQL
Indicates whether Session creation should tolerate an invalid NamedQuery.protected ConcurrencyManager
transactionMutex
Ensure mutual exclusion of the session's transaction state across multiple threads.protected boolean
wasJTSTransactionInternallyStarted
If Transactions were externally started-
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSession()
INTERNAL: Create and return a new session.protected
AbstractSession(int nothing)
INTERNAL: Create a blank session, used for proxy session.AbstractSession(Login login)
PUBLIC: Create and return a new session.AbstractSession(Project project)
PUBLIC: Create and return a new session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Session
acquireHistoricalSession(AsOfClause clause)
INTERNAL: Constructs a HistoricalSession given a valid AsOfClause.UnitOfWorkImpl
acquireNonSynchronizedUnitOfWork()
INTERNAL: Return a unit of work for this session not registered with the JTS transaction.UnitOfWorkImpl
acquireNonSynchronizedUnitOfWork(ReferenceMode referenceMode)
INTERNAL: Return a unit of work for this session not registered with the JTS transaction.RepeatableWriteUnitOfWork
acquireRepeatableWriteUnitOfWork(ReferenceMode referenceMode)
PUBLIC: Return a repeatable write unit of work for this session.UnitOfWorkImpl
acquireUnitOfWork()
PUBLIC: Return a unit of work for this session.UnitOfWorkImpl
acquireUnitOfWork(ReferenceMode referenceMode)
PUBLIC: Return a unit of work for this session.void
addAlias(String alias, ClassDescriptor descriptor)
PUBLIC: Add an alias for the descriptorvoid
addJPAQuery(DatabaseQuery query)
INTERNAL: Return all pre-defined not yet parsed EJBQL queries.void
addJPATablePerTenantQuery(DatabaseQuery query)
INTERNAL: Return all pre-defined not yet parsed EJBQL multitenant queries.void
addMultitenantContextProperty(String contextProperty)
PUBLIC: Return a set of multitenant context properties this sessionvoid
addQuery(String name, DatabaseQuery query)
PUBLIC: Add the query to the session queries with the given name.void
addQuery(String name, DatabaseQuery query, boolean replace)
PUBLIC: Add the query to the session queries with the given name.protected void
addQuery(DatabaseQuery query, boolean nameMustBeUnique)
INTERNAL: Add the query to the session queries.void
addStaticMetamodelClass(String modelClassName, String metamodelClassName)
INTERNAL: Add a metamodel class to model class reference.protected void
addTablePerTenantDescriptor(ClassDescriptor descriptor)
INTERNAL: Add a descriptor that is uses a table per tenant multitenant policy.protected void
addTablePerTenantQuery(DatabaseQuery query)
INTERNAL: Add a query that queries a table per tenant entityprotected void
basicBeginTransaction()
INTERNAL: Called by beginTransaction() to start a transaction.protected void
basicBeginTransaction(Accessor accessor)
INTERNAL: Called by beginTransaction() to start a transaction.protected void
basicCommitTransaction()
INTERNAL: Called by commitTransaction() to commit a transaction.Object
basicExecuteCall(Call call, AbstractRecord translationRow, DatabaseQuery query)
INTERNAL: Execute the call on each accessors and merge the results.protected void
basicRollbackTransaction()
INTERNAL: Called by rollbackTransaction() to rollback a transaction.boolean
beginExternalTransaction()
INTERNAL: Attempts to begin an external transaction.void
beginTransaction()
PUBLIC: Begin a transaction on the database.protected JPAQueryBuilder
buildDefaultQueryBuilder()
INTERNAL Build the JPQL builder based on session properties.void
checkAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor)
INTERNAL: Check if the object is invalid and refresh it.protected ClassDescriptor
checkHierarchyForDescriptor(Class theClass)
Check to see if the descriptor of a superclass can be used to describe this classvoid
cleanUpInjectionManager()
allow the entity listener injection manager to clean itself up.void
clearDescriptors()
INTERNAL: Clear the the descriptors cache.void
clearIntegrityChecker()
PUBLIC: clear the integrityChecker.void
clearLastDescriptorAccessed()
INTERNAL: Clear the the lastDescriptorAccessed cache.void
clearProfile()
PUBLIC: Clear the profiler, this will end the current profile operation.Object
clone()
INTERNAL: Clones the descriptorboolean
commitExternalTransaction()
INTERNAL: Attempts to commit the running internally started external transaction.void
commitTransaction()
PUBLIC: Commit the active database transaction.boolean
compareObjects(Object firstObject, Object secondObject)
INTERNAL: Return if the two object match completely.boolean
compareObjectsDontMatch(Object firstObject, Object secondObject)
TESTING: Return true if the object do not match.void
config(String message, String category)
PUBLIC:boolean
containsQuery(String queryName)
PUBLIC: Return true if the pre-defined query is defined on the session.Object
copy(Object originalObjectOrObjects)
PUBLIC: Return a complete copy of the object or of collection of objects.Object
copy(Object originalObjectOrObjects, AttributeGroup group)
PUBLIC: Return a complete copy of the object or of collection of objects.void
copyDescriptorNamedQueries(boolean allowSameQueryNameDiffArgsCopyToSession)
INTERNAL: This method will be used to copy all EclipseLink named queries defined in descriptors into the session.void
copyDescriptorsFromProject()
INTERNAL: Copies descriptors cached on the Project.Object
copyInternal(Object originalObject, CopyGroup copyGroup)
INTERNAL:Vector
copyReadOnlyClasses()
INTERNAL: Copy the read only classes from the unit of work Added Nov 8, 2000 JED for Patch 2.5.1.8 Ref: Prs 24502DatabaseValueHolder
createCloneQueryValueHolder(ValueHolderInterface attributeValue, Object clone, AbstractRecord row, ForeignReferenceMapping mapping)
DatabaseValueHolder
createCloneTransformationValueHolder(ValueHolderInterface attributeValue, Object original, Object clone, AbstractTransformationMapping mapping)
<T> InjectionManager<T>
createInjectionManager(Object beanManager)
Object
createProtectedInstanceFromCachedData(Object cached, Integer refreshCascade, ClassDescriptor descriptor)
INTERNAL: This method is similar to getAndCloneCacheKeyFromParent.void
deferEvent(DescriptorEvent event)
INTERNAL: Add an event to the deferred list.void
deleteAllObjects(Collection domainObjects)
PUBLIC: delete all of the objects and all of their privately owned parts in the database.Object
deleteObject(Object domainObject)
PUBLIC: Delete the object and all of its privately owned parts from the database.boolean
doesObjectExist(Object object)
PUBLIC: Return if the object exists on the database or not.void
dontLogMessages()
PUBLIC: Turn off loggingvoid
endOperationProfile(String operationName)
INTERNAL: End the operation timing.void
endOperationProfile(String operationName, DatabaseQuery query, int weight)
INTERNAL: End the operation timing.Object
executeCall(Call call, AbstractRecord translationRow, DatabaseQuery query)
INTERNAL: Overridden by subclasses that do more than just execute the call.void
executeDeferredEvents()
INTERNAL: Causes any deferred events to be fired.int
executeNonSelectingCall(Call call)
PUBLIC: Execute the call on the database.void
executeNonSelectingSQL(String sqlString)
PUBLIC: Execute the sql on the database.Object
executeQuery(String queryName)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass, Object arg1)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass, Object arg1, Object arg2)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass, Object arg1, Object arg2, Object arg3)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass, List argumentValues)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Class domainClass, Vector argumentValues)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Object arg1)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Object arg1, Object arg2)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Object arg1, Object arg2, Object arg3)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, List argumentValues)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(String queryName, Vector argumentValues)
PUBLIC: Execute the pre-defined query by name and return the result.Object
executeQuery(DatabaseQuery query)
PUBLIC: Execute the database query.Object
executeQuery(DatabaseQuery query, List argumentValues)
PUBLIC: Return the results from executing the database query.Object
executeQuery(DatabaseQuery query, AbstractRecord row)
INTERNAL: Return the results from executing the database query.Object
executeQuery(DatabaseQuery query, AbstractRecord row, int retryCount)
INTERNAL: Return the results from executing the database query.Vector
executeSelectingCall(Call call)
PUBLIC: Execute the call on the database and return the result.Vector
executeSQL(String sqlString)
PUBLIC: Execute the sql on the database and return the result.void
fine(String message, String category)
PUBLIC:void
finer(String message, String category)
PUBLIC:void
finest(String message, String category)
PUBLIC:Accessor
getAccessor()
INTERNAL: This should normally not be used, most sessions do not have a single accessor.Collection<Accessor>
getAccessors()
INTERNAL: This should normally not be used, most sessions do not have specific accessors.Collection<Accessor>
getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)
INTERNAL: Return the connections to use for the query execution.ExposedNodeLinkedList
getActiveCommandThreads()
INTERNAL:Session
getActiveSession()
PUBLIC: Return the active session for the current active external (JTS) transaction.UnitOfWork
getActiveUnitOfWork()
PUBLIC: Return the active unit of work for the current active external (JTS) transaction.Map
getAliasDescriptors()
INTERNAL: Returns the alias descriptors Map.List<DatabaseQuery>
getAllQueries()
INTERNAL: Return the pre-defined queries in this session.AsOfClause
getAsOfClause()
ADVANCED: Answers the past time this session is as of.Map<String,AttributeGroup>
getAttributeGroups()
ADVANCED Return all predefined attribute groupsAbstractSession
getBroker()
INTERNAL: Allow the session to be used from a session broker.protected CacheKey
getCacheKeyFromTargetSessionForMerge(Object implementation, ObjectBuilder builder, ClassDescriptor descriptor, MergeManager mergeManager)
INTERNAL: For use within the merge process this method will get an object from the shared cache using a readlock.ClassDescriptor
getClassDescriptor(Class theClass)
ADVANCED: Return the descriptor specified for the class.ClassDescriptor
getClassDescriptor(Object domainObject)
ADVANCED: Return the descriptor specified for the object's class.ClassDescriptor
getClassDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias.CommandManager
getCommandManager()
PUBLIC: Return the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.CommitManager
getCommitManager()
INTERNAL: The commit manager is used to resolve referential integrity on commits of multiple objects.Login
getDatasourceLogin()
PUBLIC: Return the login, the login holds any database connection information given.Platform
getDatasourcePlatform()
INTERNAL: Return the database platform currently connected to.Vector
getDefaultReadOnlyClasses()
INTERNAL: Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.ReferenceMode
getDefaultReferenceMode()
Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.ClassDescriptor
getDescriptor(Class theClass)
ADVANCED: Return the descriptor specified for the class.ClassDescriptor
getDescriptor(Object domainObject)
ADVANCED: Return the descriptor specified for the object's class.ClassDescriptor
getDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias.Map<Class,ClassDescriptor>
getDescriptors()
ADVANCED: Return all registered descriptors.SessionEventManager
getEventManager()
PUBLIC: Return the event manager.ExceptionHandler
getExceptionHandler()
PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.String
getExceptionHandlerClass()
INTERNAL: Return a string which represents my ExceptionHandler's class Added for F2104: Properties.xml - gnAbstractSession
getExecutionSession(DatabaseQuery query)
INTERNAL: Gets the session which this query will be executed on.ExternalTransactionController
getExternalTransactionController()
PUBLIC: Used for JTS integration.Object
getId(Object domainObject)
ADVANCED: Extract and return the primary key from the object.IdentityMapAccessor
getIdentityMapAccessor()
PUBLIC: The IdentityMapAccessor is the preferred way of accessing IdentityMap funcitons This will return an object which implements an interface which exposes all public IdentityMap functions.IdentityMapAccessor
getIdentityMapAccessorInstance()
INTERNAL: Return the internally available IdentityMapAccessor instance.<T> InjectionManager<T>
getInjectionManager()
IntegrityChecker
getIntegrityChecker()
PUBLIC: Returns the integrityChecker.IntegrityChecker holds all the ClassDescriptor Exceptions.List<DatabaseQuery>
getJPAQueries()
ADVANCED: Return all pre-defined not yet parsed JPQL queries.List<DatabaseQuery>
getJPATablePerTenantQueries()
ADVANCED: Return all pre-defined not yet parsed JPQL queries.ClassLoader
getLoader()
INTERNAL: Return the class loader for the session's application.Writer
getLog()
PUBLIC: Return the writer to which an accessor writes logged messages and SQL.DatabaseLogin
getLogin()
OBSOLETE: Return the login, the login holds any database connection information given.int
getLogLevel()
PUBLIC:int
getLogLevel(String category)
PUBLIC:String
getLogSessionString()
INTERNAL: Return the name of the session: class name + system hashcode.ClassDescriptor
getMappedSuperclass(String className)
INTERNAL: Return the mapped superclass descriptor if one exists for the given class name.Set<String>
getMultitenantContextProperties()
PUBLIC: Return a set of multitenant context properties this sessionString
getName()
PUBLIC: Return the name of the session.long
getNextQueryId()
INTERNAL: Called by a sessions queries to obtain individual query ids.Number
getNextSequenceNumberValue(Class domainClass)
ADVANCED: Return the sequnce number from the databaseint
getNumberOfActiveUnitsOfWork()
INTERNAL: Return the number of units of work connected.AbstractSession
getParent()
INTERNAL: Gets the parent session.AbstractSession
getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)
INTERNAL: Returns the appropriate IdentityMap session for this descriptor.AbstractSession
getParentIdentityMapSession(DatabaseQuery query)
INTERNAL: Gets the next link in the chain of sessions followed by a query's check early return, the chain of sessions with identity maps all the way up to the root session.AbstractSession
getParentIdentityMapSession(DatabaseQuery query, boolean canReturnSelf, boolean terminalOnly)
INTERNAL: Gets the next link in the chain of sessions followed by a query's check early return, the chain of sessions with identity maps all the way up to the root session.PartitioningPolicy
getPartitioningPolicy()
PUBLIC: Return the session's partitioning policy.Integer
getPessimisticLockTimeoutDefault()
INTERNAL: Returns the default pessimistic lock timeout value.TimeUnit
getPessimisticLockTimeoutUnitDefault()
DatabasePlatform
getPlatform()
INTERNAL: Return the database platform currently connected to.Platform
getPlatform(Class domainClass)
INTERNAL: Return the database platform currently connected to for specified class.SessionProfiler
getProfiler()
PUBLIC: Return the profiler.Project
getProject()
PUBLIC: Return the project, the project holds configuartion information including the descriptors.Map<String,Object>
getProperties()
ADVANCED: Allow for user defined properties.Object
getProperty(String name)
ADVANCED: Returns the user defined property.Map<String,List<DatabaseQuery>>
getQueries()
ADVANCED: Return all pre-defined queries.DatabaseQuery
getQuery(String name)
PUBLIC: Return the query from the session pre-defined queries with the given name.DatabaseQuery
getQuery(String name, List arguments)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types.DatabaseQuery
getQuery(String name, Vector arguments)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types.DatabaseQuery
getQuery(String name, Vector arguments, boolean shouldSearchParent)
INTERNAL: Return the query from the session pre-defined queries with the given name and argument types.JPAQueryBuilder
getQueryBuilder()
INTERNAL Return the query builder used to parser JPQL.int
getQueryTimeoutDefault()
PUBLIC: Return the default query timeout for this session.TimeUnit
getQueryTimeoutUnitDefault()
MetadataRefreshListener
getRefreshMetadataListener()
INTERNAL: This currently only used by JPA with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappersAbstractSession
getRootSession(DatabaseQuery query)
INTERNAL: The session that this query is executed against when not in transaction.Sequencing
getSequencing()
INTERNAL: Return the Sequencing object used by the session.Serializer
getSerializer()
Return the Serializer to use by default for serialization.ServerPlatform
getServerPlatform()
INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within EclipseLink's other sessions types (ie not DatabaseSession)AbstractSession
getSessionForClass(Class domainClass)
INTERNAL: Return the session to be used for the class.AbstractSession
getSessionForName(String name)
INTERNAL: Return the session by name.SessionLog
getSessionLog()
PUBLIC: Return the session log to which an accessor logs messages and SQL.String
getSessionTypeString()
INTERNAL: Returns the type of session, its class.String
getStaticMetamodelClass(String modelClassName)
INTERNAL: Return the static metamodel class associated with the given model class if available.List<ClassDescriptor>
getTablePerTenantDescriptors()
INTERNAL: Return list of table per tenant multitenant descriptors.List<DatabaseQuery>
getTablePerTenantQueries()
INTERNAL: Return list of table per tenant multitenant descriptors.ConcurrencyManager
getTransactionMutex()
INTERNAL: The transaction mutex ensure mutual exclusion on transaction across multiple threads.Object
handleException(RuntimeException exception)
PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.Object
handleSevere(RuntimeException exception)
PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.boolean
hasBroker()
INTERNAL: Allow the session to be used from a session broker.boolean
hasCommitManager()
INTERNAL: Return if the commit manager has been set.boolean
hasDescriptor(Class theClass)
ADVANCED: Return true if a descriptor exists for the given class.boolean
hasEventManager()
INTERNAL: Return if an event manager has been set.boolean
hasExceptionHandler()
PUBLIC: Return if an exception handler is present.boolean
hasExternalTransactionController()
PUBLIC: Used for JTA integration.boolean
hasProperties()
INTERNAL: Allow to check for user defined properties.boolean
hasTablePerTenantDescriptors()
INTERNAL: Return list of table per tenant multitenant descriptors.boolean
hasTablePerTenantQueries()
INTERNAL: Return a list of table per tenant multitenant queries.void
incrementProfile(String operationName)
INTERNAL: Updates the count of SessionProfiler eventvoid
incrementProfile(String operationName, DatabaseQuery query)
INTERNAL: Updates the count of SessionProfiler eventvoid
info(String message, String category)
PUBLIC:void
initializeIdentityMapAccessor()
INTERNAL: Set up the IdentityMapManager.Object
insertObject(Object domainObject)
PUBLIC: Insert the object and all of its privately owned parts into the database.Object
internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow)
INTERNAL: Return the results from exeucting the database query.boolean
isBroker()
INTERNAL: Returns true if the session is a session Broker.boolean
isClassReadOnly(Class theClass)
PUBLIC: Return if the class is defined as read-only.boolean
isClassReadOnly(Class theClass, ClassDescriptor descriptor)
INTERNAL: Return if the class is defined as read-only.boolean
isClientSession()
PUBLIC: Return if this session is a client session.boolean
isConcurrent()
ADVANCED: Return if the session enables concurrent processing.boolean
isConnected()
PUBLIC: Return if this session is connected to the database.boolean
isConsideredInvalid(Object object, CacheKey cacheKey, ClassDescriptor descriptor)
INTERNAL: Check if the object is invalid and *should* be refreshed.boolean
isDatabaseSession()
PUBLIC: Return if this session is a database session.boolean
isDistributedSession()
PUBLIC: Return if this session is a distributed session.boolean
isExclusiveConnectionRequired()
INTERNAL: This method is called in case externalConnectionPooling is used.boolean
isExclusiveIsolatedClientSession()
PUBLIC: Return if this session is an exclusive isolated client session.boolean
isFinalizersEnabled()
PUBLIC: Return if this session's decendants should use finalizers.boolean
isHistoricalSession()
INTERNAL: Return if this session is a historical session.boolean
isInBroker()
INTERNAL: Returns true if the session is in a session Broker.boolean
isInProfile()
PUBLIC: Return if a profiler is being used.boolean
isInTransaction()
PUBLIC: Return if the session is currently in the progress of a database transaction.boolean
isIsolatedClientSession()
PUBLIC: Return if this session is an isolated client session.boolean
isJPAQueriesProcessed()
INTERNAL: used to see if JPA Queries have been processed during initializationboolean
isLoggingOff()
INTERNAL: PERF: Used for quick check if logging is OFF entirely.boolean
isProtectedSession()
PUBLIC: Returns true if Protected Entities should be built within this sessionboolean
isRemoteSession()
PUBLIC: Return if this session is remote.boolean
isRemoteUnitOfWork()
PUBLIC: Return if this session is a unit of work.boolean
isServerSession()
PUBLIC: Return if this session is a server session.boolean
isSessionBroker()
PUBLIC: Return if this session is a session broker.boolean
isSynchronized()
INTERNAL: Return if this session is synchronized.boolean
isUnitOfWork()
PUBLIC: Return if this session is a unit of work.Object
keyFromObject(Object domainObject, ClassDescriptor descriptor)
ADVANCED: Extract and return the primary key from the object.void
load(Object objectOrCollection, AttributeGroup group)
This method will load the passed object or collection of objects using the passed AttributeGroup.void
load(Object objectOrCollection, AttributeGroup group, ClassDescriptor referenceDescriptor, boolean fromFetchGroup)
This method will load the passed object or collection of objects using the passed AttributeGroup.void
log(int level, String category, String message)
PUBLIC:void
log(int level, String category, String message, Object param)
PUBLIC:void
log(int level, String category, String message, Object[] params)
PUBLIC:void
log(int level, String category, String message, Object[] params, Accessor accessor)
PUBLIC:void
log(int level, String category, String message, Object[] params, Accessor accessor, boolean shouldTranslate)
PUBLIC:void
log(int level, String category, String message, Object param1, Object param2)
PUBLIC:void
log(int level, String category, String message, Object param1, Object param2, Object param3)
PUBLIC:void
log(SessionLogEntry entry)
PUBLIC: Log the log entry.void
logMessage(int logLevel, String message)
INTERNAL: RemoteCommandManager method.void
logMessage(String message)
Log a untranslated message to the EclipseLink log at FINER level.void
logThrowable(int level, String category, Throwable throwable)
PUBLIC:void
postAcquireConnection(Accessor accessor)
INTERNAL: This method rises appropriate for the session event(s) right after connection is acquired.DatabaseQuery
prepareDatabaseQuery(DatabaseQuery query)
INTERNAL: A call back to do session specific preparation of a query.void
preReleaseConnection(Accessor accessor)
INTERNAL: This method rises appropriate for the session event(s) right before the connection is released.int
priviledgedExecuteNonSelectingCall(Call call)
INTERNAL: Execute the call on the database.Vector
priviledgedExecuteSelectingCall(Call call)
INTERNAL: Execute the call on the database and return the result.void
processCommand(Object command)
INTERNAL: RemoteCommandManager method.void
processJPAQueries()
INTERNAL: Process the JPA named queries into EclipseLink Session queries.protected void
processJPAQuery(DatabaseQuery jpaQuery)
INTERNAL: Process the JPA named query into an EclipseLink Session query.Vector
readAllObjects(Class domainClass)
PUBLIC: Read all of the instances of the class from the database.Vector
readAllObjects(Class domainClass, String sqlString)
PUBLIC: Read all of the instances of the class from the database return through execution the SQL string.Vector
readAllObjects(Class domainClass, Expression expression)
PUBLIC: Read all of the instances of the class from the database matching the given expression.Vector
readAllObjects(Class referenceClass, Call aCall)
PUBLIC: Read all the instances of the class from the database returned through execution the Call string.Object
readObject(Class domainClass)
PUBLIC: Read the first instance of the class from the database.Object
readObject(Class domainClass, String sqlString)
PUBLIC: Read the first instance of the class from the database return through execution the SQL string.Object
readObject(Class domainClass, Expression expression)
PUBLIC: Read the first instance of the class from the database matching the given expression.Object
readObject(Class domainClass, Call aCall)
PUBLIC: Read the first instance of the class from the database returned through execution the Call string.Object
readObject(Object object)
PUBLIC: Use the example object to consruct a read object query by the objects primary key.Object
refreshAndLockObject(Object object)
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.Object
refreshAndLockObject(Object object, short lockMode)
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.Object
refreshObject(Object object)
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.void
registerFinalizer()
INTERNAL: Register a finalizer to release this session.void
release()
PUBLIC: Release the session.void
releaseConnectionAfterCall(DatabaseQuery query)
INTERNAL: Release (if required) connection after call.void
releaseJTSConnection()
INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener.void
releaseReadConnection(Accessor connection)
INTERNAL:void
releaseUnitOfWork(UnitOfWorkImpl unitOfWork)
INTERNAL: Release the unit of work, if lazy release the connection.void
removeProperty(String property)
PUBLIC: Remove the user defined property.void
removeQuery(String queryName)
PUBLIC: Remove all queries with the given queryName regardless of the argument types.void
removeQuery(String queryName, Vector argumentTypes)
PUBLIC: Remove the specific query with the given queryName and argumentTypes.CacheKey
retrieveCacheKey(Object primaryKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager, ObjectBuildingQuery query)
Object
retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
INTERNAL: A query execution failed due to an invalid query.DatabaseException
retryTransaction(Accessor accessor, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
INTERNAL: A begin transaction failed.protected boolean
rollbackExternalTransaction()
PROTECTED: Attempts to rollback the running internally started external transaction.void
rollbackTransaction()
PUBLIC: Rollback the active database transaction.void
setAccessor(Accessor accessor)
INTERNAL: Set the accessor.void
setBroker(AbstractSession broker)
INTERNAL: Allow the session to be used from a session broker.void
setCommandManager(CommandManager mgr)
ADVANCED: Set the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.void
setCommitManager(CommitManager commitManager)
INTERNAL: The commit manager is used to resolve referncial integrity on commits of multiple objects.void
setDatasourceLogin(Login login)
PUBLIC: Set the login.void
setDefaultReferenceMode(ReferenceMode defaultReferenceMode)
Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.void
setEventManager(SessionEventManager eventManager)
INTERNAL: Set the event manager.void
setExceptionHandler(ExceptionHandler exceptionHandler)
PUBLIC: Set the exceptionHandler.void
setExternalTransactionController(ExternalTransactionController externalTransactionController)
Used for JTS integration internally by ServerPlatform.void
setInjectionManager(InjectionManager injectionManager)
void
setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC: set the integrityChecker.void
setIsConcurrent(boolean isConcurrent)
ADVANCED: Set if the session enables concurrent processing.void
setIsFinalizersEnabled(boolean isFinalizersEnabled)
PUBLIC: Set if this session's decendants should use finalizers.void
setIsInBroker(boolean isInBroker)
INTERNAL: Set if this session is contained in a SessionBroker.void
setIsInProfile(boolean inProfile)
PUBLIC: Allow for user deactive a profilervoid
setJPAQueriesProcessed(boolean jpaQueriesProcessed)
INTERNAL: used to set if JPA Queries have been processed during initializationvoid
setLog(Writer log)
PUBLIC: Set the writer to which an accessor writes logged messages and SQL.void
setLoggingOff(boolean loggingOff)
INTERNAL: PERF: Used for quick turning logging ON/OFF entirely.void
setLogin(DatabaseLogin login)
PUBLIC: Set the login.void
setLogin(Login login)
PUBLIC: Set the login.void
setLogLevel(int level)
PUBLIC:void
setName(String name)
PUBLIC: Set the name of the session.protected void
setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)
void
setPartitioningPolicy(PartitioningPolicy partitioningPolicy)
PUBLIC: Set the session's partitioning policy.void
setPessimisticLockTimeoutDefault(Integer pessimisticLockTimeoutDefault)
PUBLIC: Set the default pessimistic lock timeout value.void
setPessimisticLockTimeoutUnitDefault(TimeUnit pessimisticLockTimeoutUnitDefault)
void
setProfiler(SessionProfiler profiler)
PUBLIC: Set the profiler for the session.void
setProject(Project project)
INTERNAL: Set the project, the project holds configuration information including the descriptors.void
setProperties(Map<String,Object> propertiesMap)
INTERNAL: Set the user defined properties by shallow copying the propertiesMap.void
setProperty(String propertyName, Object propertyValue)
PUBLIC: Allow for user defined properties.void
setQueries(Map<String,List<DatabaseQuery>> queries)
INTERNAL: Set the named queries.void
setQueryBuilder(JPAQueryBuilder queryBuilder)
INTERNAL Set the query builder used to parser JPQL.void
setQueryTimeoutDefault(int queryTimeoutDefault)
PUBLIC: Set the default query timeout for this session.void
setQueryTimeoutUnitDefault(TimeUnit queryTimeoutUnitDefault)
PUBLIC: Set the default query timeout units for this session.void
setRefreshMetadataListener(MetadataRefreshListener metadatalistener)
void
setSerializer(Serializer serializer)
Set the Serializer to use by default for serialization.void
setSessionLog(SessionLog sessionLog)
PUBLIC: Set the session log to which an accessor logs messages and SQL.void
setShouldOptimizeResultSetAccess(boolean shouldOptimizeResultSetAccess)
ADVANCED: Set to indicate whether ObjectLevelReadQuery should by default use ResultSet Access optimization.void
setShouldPropagateChanges(boolean choice)
ADVANCED: Set whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism.void
setSynchronized(boolean synched)
INTERNAL: Set isSynchronized flag to indicate that this session is synchronized.void
setTolerateInvalidJPQL(boolean b)
ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time.protected void
setTransactionMutex(ConcurrencyManager transactionMutex)
void
setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)
INTERNAL: Return if a JTS transaction was started by the session.void
severe(String message, String category)
PUBLIC:boolean
shouldDisplayData()
PUBLIC: Return true if SQL logging should log visible bind parameters.boolean
shouldLog(int level, String category)
PUBLIC:boolean
shouldLogMessages()
PUBLIC: Return if logging is enabled (false if log level is OFF)boolean
shouldLogMessages(int logLevel)
INTERNAL: RemoteCommandManager method.boolean
shouldOptimizeResultSetAccess()
ADVANCED: Indicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization.boolean
shouldPropagateChanges()
PUBLIC: Return whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism.boolean
shouldTolerateInvalidJPQL()
ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time.void
startOperationProfile(String operationName)
INTERNAL: Start the operation timing.void
startOperationProfile(String operationName, DatabaseQuery query, int weight)
INTERNAL: Start the operation timing.String
toString()
Print the connection status with the session.Object
unwrapObject(Object proxy)
INTERNAL: Unwrap the object if required.Object
updateObject(Object domainObject)
PUBLIC: Update the object and all of its privately owned parts in the database.void
updateProfile(String operationName, Object value)
INTERNAL: Updates the value of SessionProfiler statevoid
updateTablePerTenantDescriptors(String property, Object value)
INTERNAL: Set the table per tenant.void
validateCache()
ADVANCED: This can be used to help debugging an object identity problem.void
validateQuery(DatabaseQuery query)
INTERNAL: This method will be used to update the query with any settings required For this session.boolean
verifyDelete(Object domainObject)
TESTING: This is used by testing code to ensure that a deletion was successful.void
warning(String message, String category)
PUBLIC:boolean
wasJTSTransactionInternallyStarted()
INTERNAL: Return if a JTS transaction was started by the session.Object
wrapObject(Object implementation)
INTERNAL: Wrap the object if required.protected void
writeAllObjectsWithChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL: Write all of the objects and all of their privately owned parts in the database.Object
writeObject(Object domainObject)
PUBLIC: Write the object and all of its privately owned parts in the database.void
writesCompleted()
INTERNAL: This method notifies the accessor that a particular sets of writes has completed.
-
-
-
Field Detail
-
exceptionHandler
protected transient ExceptionHandler exceptionHandler
ExceptionHandler handles database exceptions.
-
integrityChecker
protected transient IntegrityChecker integrityChecker
IntegrityChecker catch all the descriptor Exceptions.
-
project
protected transient Project project
The project stores configuration information, such as the descriptors and login.
-
transactionMutex
protected transient ConcurrencyManager transactionMutex
Ensure mutual exclusion of the session's transaction state across multiple threads.
-
identityMapAccessor
protected IdentityMapAccessor identityMapAccessor
Manages the live object cache.
-
wasJTSTransactionInternallyStarted
protected boolean wasJTSTransactionInternallyStarted
If Transactions were externally started
-
accessors
protected transient Collection<Accessor> accessors
The connection to the data store.
-
platform
protected transient Platform platform
Allow the datasource platform to be cached.
-
queries
protected transient Map<String,List<DatabaseQuery>> queries
Stores predefine reusable queries.
-
attributeGroups
protected Map<String,AttributeGroup> attributeGroups
Stores predefined reusable AttributeGroups.
-
jpaQueriesProcessed
protected boolean jpaQueriesProcessed
Stores predefined not yet parsed JPQL queries.
-
commitManager
protected transient CommitManager commitManager
Resolves referential integrity on commits.
-
profiler
protected transient SessionProfiler profiler
Tool that log performance information.
-
broker
protected transient AbstractSession broker
Support being owned by a session broker.
-
name
protected String name
Used to identify a session when using the session broker.
-
numberOfActiveUnitsOfWork
protected transient int numberOfActiveUnitsOfWork
Keep track of active units of work.
-
objectsLockedForClone
protected Map objectsLockedForClone
This collection will be used to store those objects that are currently locked for the clone process. It should be populated with an EclipseLinkIdentityHashMap
-
sessionLog
protected transient SessionLog sessionLog
Destination for logged messages and SQL.
-
logSessionString
protected transient String logSessionString
When logging the name of the session is typed: class name + system hashcode.
-
eventManager
protected transient SessionEventManager eventManager
Stores the event listeners for this session.
-
externalTransactionController
protected transient ExternalTransactionController externalTransactionController
Delegate that handles synchronizing a UnitOfWork with an external transaction.
-
lastDescriptorAccessed
protected transient ClassDescriptor lastDescriptorAccessed
Last descriptor accessed, use to optimize descriptor lookup.
-
descriptors
protected transient Map<Class,ClassDescriptor> descriptors
PERF: cache descriptors from project.
-
tablePerTenantDescriptors
protected transient List<ClassDescriptor> tablePerTenantDescriptors
PERF: cache table per tenant descriptors needing to be initialized per EM
-
tablePerTenantQueries
protected transient List<DatabaseQuery> tablePerTenantQueries
PERF: cache table per tenant queries needing to be initialized per EM
-
isInBroker
protected boolean isInBroker
Used to determine If a session is in a Broker or not
-
commandManager
protected transient CommandManager commandManager
Used to connect this session to EclipseLink cluster for distributed command
-
shouldCheckWriteLock
protected boolean shouldCheckWriteLock
PERF: Cache the write-lock check to avoid cost of checking in every register/clone.
-
shouldPropagateChanges
protected boolean shouldPropagateChanges
Determined whether changes should be propagated to an EclipseLink cluster
-
isInProfile
protected boolean isInProfile
Used to determine If a session is in a profile or not
-
isLoggingOff
protected boolean isLoggingOff
PERF: Quick check if logging is OFF entirely.
-
isFinalizersEnabled
protected boolean isFinalizersEnabled
PERF: Allow for finalizers to be enabled, currently enables client-session finalize.
-
activeCommandThreads
protected transient ExposedNodeLinkedList activeCommandThreads
List of active command threads.
-
isSynchronized
protected boolean isSynchronized
Indicates whether the session is synchronized. In case external transaction controller is used isSynchronized==true means the session's jta connection will be freed during external transaction callback.
-
defaultReferenceMode
protected ReferenceMode defaultReferenceMode
Stores the default reference mode that a UnitOfWork will use when referencing managed objects.- See Also:
ReferenceMode
-
pessimisticLockTimeoutDefault
protected Integer pessimisticLockTimeoutDefault
Default pessimistic lock timeout value.
-
pessimisticLockTimeoutUnitDefault
protected TimeUnit pessimisticLockTimeoutUnitDefault
-
queryTimeoutDefault
protected int queryTimeoutDefault
-
queryTimeoutUnitDefault
protected TimeUnit queryTimeoutUnitDefault
-
isConcurrent
protected boolean isConcurrent
Allow a session to enable concurrent processing.
-
staticMetamodelClasses
protected Map<String,String> staticMetamodelClasses
This map will hold onto class to static metamodel class references from JPA.
-
deferredEvents
protected List<DescriptorEvent> deferredEvents
temporarily holds a list of events that must be fired after the current operation completes. Initialy created for postClone events.
-
isExecutingEvents
protected boolean isExecutingEvents
records that the UOW is executing deferred events. Events could cause operations to occur that may attempt to restart the event execution. This must be avoided
-
partitioningPolicy
protected PartitioningPolicy partitioningPolicy
Allow queries to be targeted at specific connection pools.
-
metadatalistener
protected MetadataRefreshListener metadatalistener
the MetadataRefreshListener is used with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappers
-
multitenantContextProperties
protected Set<String> multitenantContextProperties
Stores the set of multitenant context properties this session requires
-
queryBuilder
protected transient JPAQueryBuilder queryBuilder
Store the query builder used to parse JPQL.
-
serializer
protected transient Serializer serializer
Set the Serializer to use by default for serialization.
-
injectionManager
protected transient InjectionManager injectionManager
Allow CDI injection of entity listeners
-
shouldOptimizeResultSetAccess
protected boolean shouldOptimizeResultSetAccess
Indicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization. Optimization specified by the session is ignored if incompatible with other query settings.
-
tolerateInvalidJPQL
protected boolean tolerateInvalidJPQL
Indicates whether Session creation should tolerate an invalid NamedQuery. If true, an exception will be thrown on .createNamedQuery(..) rather than at init time.
-
-
Constructor Detail
-
AbstractSession
protected AbstractSession()
INTERNAL: Create and return a new session. This should only be called if the database login information is not know at the time of creation. Normally it is better to call the constructor that takes the login information as an argument so that the session can initialize itself to the platform information given in the login.
-
AbstractSession
protected AbstractSession(int nothing)
INTERNAL: Create a blank session, used for proxy session.
-
AbstractSession
public AbstractSession(Login login)
PUBLIC: Create and return a new session. By giving the login information on creation this allows the session to initialize itself to the platform given in the login. This constructor does not return a connected session. To connect the session to the database login() must be sent to it. The login(userName, password) method may also be used to connect the session, this allows for the user name and password to be given at login but for the other database information to be provided when the session is created.
-
AbstractSession
public AbstractSession(Project project)
PUBLIC: Create and return a new session. This constructor does not return a connected session. To connect the session to the database login() must be sent to it. The login(userName, password) method may also be used to connect the session, this allows for the user name and password to be given at login but for the other database information to be provided when the session is created.
-
-
Method Detail
-
getSerializer
public Serializer getSerializer()
Return the Serializer to use by default for serialization.- Specified by:
getSerializer
in interfaceSession
-
setSerializer
public void setSerializer(Serializer serializer)
Set the Serializer to use by default for serialization.- Specified by:
setSerializer
in interfaceSession
-
getQueryBuilder
public JPAQueryBuilder getQueryBuilder()
INTERNAL Return the query builder used to parser JPQL.
-
setQueryBuilder
public void setQueryBuilder(JPAQueryBuilder queryBuilder)
INTERNAL Set the query builder used to parser JPQL.
-
buildDefaultQueryBuilder
protected JPAQueryBuilder buildDefaultQueryBuilder()
INTERNAL Build the JPQL builder based on session properties.
-
setLoggingOff
public void setLoggingOff(boolean loggingOff)
INTERNAL: PERF: Used for quick turning logging ON/OFF entirely.- Parameters:
loggingOff
- Logging is turned off whentrue
and turned on whenfalse
.
-
isLoggingOff
public boolean isLoggingOff()
INTERNAL: PERF: Used for quick check if logging is OFF entirely.
-
getNextQueryId
public long getNextQueryId()
INTERNAL: Called by a sessions queries to obtain individual query ids. CR #2698903
-
acquireNonSynchronizedUnitOfWork
public UnitOfWorkImpl acquireNonSynchronizedUnitOfWork()
INTERNAL: Return a unit of work for this session not registered with the JTS transaction.
-
acquireNonSynchronizedUnitOfWork
public UnitOfWorkImpl acquireNonSynchronizedUnitOfWork(ReferenceMode referenceMode)
INTERNAL: Return a unit of work for this session not registered with the JTS transaction.
-
acquireHistoricalSession
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
INTERNAL: Constructs a HistoricalSession given a valid AsOfClause.- Specified by:
acquireHistoricalSession
in interfaceSession
- Parameters:
clause
- Represents a valid snap shot time.- Throws:
ValidationException
- ifthis
not a ClientSession, plain Session, or SessionBroker.- See Also:
AsOfClause
,Expression.asOf(org.eclipse.persistence.history.AsOfClause)
,ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause)
,HistoryPolicy
-
acquireUnitOfWork
public UnitOfWorkImpl acquireUnitOfWork()
PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit.- Specified by:
acquireUnitOfWork
in interfaceSession
- See Also:
UnitOfWorkImpl
-
acquireRepeatableWriteUnitOfWork
public RepeatableWriteUnitOfWork acquireRepeatableWriteUnitOfWork(ReferenceMode referenceMode)
PUBLIC: Return a repeatable write unit of work for this session. A repeatable write unit of work allows multiple writeChanges (flushes).- See Also:
RepeatableWriteUnitOfWork
-
acquireUnitOfWork
public UnitOfWorkImpl acquireUnitOfWork(ReferenceMode referenceMode)
PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit.- Specified by:
acquireUnitOfWork
in interfaceSession
- Parameters:
referenceMode
- The reference type the UOW should use internally when referencing Working clones. Setting this to WEAK means the UOW will use weak references to reference clones that support active object change tracking and hard references for deferred change tracked objects. Setting to FORCE_WEAK means that all objects will be referenced by weak references and if the application no longer references the clone the clone may be garbage collected. If the clone has uncommitted changes then those changes will be lost.- See Also:
UnitOfWorkImpl
-
addAlias
public void addAlias(String alias, ClassDescriptor descriptor)
PUBLIC: Add an alias for the descriptor
-
addJPAQuery
public void addJPAQuery(DatabaseQuery query)
INTERNAL: Return all pre-defined not yet parsed EJBQL queries.- Specified by:
addJPAQuery
in interfaceSession
-
addJPATablePerTenantQuery
public void addJPATablePerTenantQuery(DatabaseQuery query)
INTERNAL: Return all pre-defined not yet parsed EJBQL multitenant queries.
-
addMultitenantContextProperty
public void addMultitenantContextProperty(String contextProperty)
PUBLIC: Return a set of multitenant context properties this session
-
addQuery
protected void addQuery(DatabaseQuery query, boolean nameMustBeUnique)
INTERNAL: Add the query to the session queries.
-
addQuery
public void addQuery(String name, DatabaseQuery query)
PUBLIC: Add the query to the session queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
-
addQuery
public void addQuery(String name, DatabaseQuery query, boolean replace)
PUBLIC: Add the query to the session queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
-
addStaticMetamodelClass
public void addStaticMetamodelClass(String modelClassName, String metamodelClassName)
INTERNAL: Add a metamodel class to model class reference.
-
addTablePerTenantDescriptor
protected void addTablePerTenantDescriptor(ClassDescriptor descriptor)
INTERNAL: Add a descriptor that is uses a table per tenant multitenant policy.
-
addTablePerTenantQuery
protected void addTablePerTenantQuery(DatabaseQuery query)
INTERNAL: Add a query that queries a table per tenant entity
-
basicBeginTransaction
protected void basicBeginTransaction() throws DatabaseException
INTERNAL: Called by beginTransaction() to start a transaction. This starts a real database transaction. Allows retry if the connection is dead.- Throws:
DatabaseException
-
basicBeginTransaction
protected void basicBeginTransaction(Accessor accessor) throws DatabaseException
INTERNAL: Called by beginTransaction() to start a transaction. This starts a real database transaction. Allows retry if the connection is dead.- Throws:
DatabaseException
-
retryTransaction
public DatabaseException retryTransaction(Accessor accessor, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
INTERNAL: A begin transaction failed. Re-connect and retry the begin transaction.
-
releaseJTSConnection
public void releaseJTSConnection()
INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener. Close the managed sql connection corresponding to the external transaction, if applicable releases accessor.
-
basicCommitTransaction
protected void basicCommitTransaction() throws DatabaseException
INTERNAL: Called by commitTransaction() to commit a transaction. This commits the active transaction.- Throws:
DatabaseException
-
basicRollbackTransaction
protected void basicRollbackTransaction() throws DatabaseException
INTERNAL: Called by rollbackTransaction() to rollback a transaction. This rolls back the active transaction.- Throws:
DatabaseException
-
beginExternalTransaction
public boolean beginExternalTransaction()
INTERNAL: Attempts to begin an external transaction. Returns true only in one case - external transaction has been internally started during this method call: wasJTSTransactionInternallyStarted()==false in the beginning of this method and wasJTSTransactionInternallyStarted()==true in the end of this method.
-
beginTransaction
public void beginTransaction() throws DatabaseException, ConcurrencyException
PUBLIC: Begin a transaction on the database. This allows a group of database modification to be committed or rolled back as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.- Throws:
DatabaseException
- if the database connection is lost or the begin is rejected.ConcurrencyException
- if this session's transaction is acquired by another thread and a timeout occurs.- See Also:
isInTransaction()
-
checkHierarchyForDescriptor
protected ClassDescriptor checkHierarchyForDescriptor(Class theClass)
Check to see if the descriptor of a superclass can be used to describe this class- Parameters:
theClass
-- Returns:
- ClassDescriptor
-
cleanUpInjectionManager
public void cleanUpInjectionManager()
allow the entity listener injection manager to clean itself up.
-
clearIntegrityChecker
public void clearIntegrityChecker()
PUBLIC: clear the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.- Specified by:
clearIntegrityChecker
in interfaceSession
-
clearLastDescriptorAccessed
public void clearLastDescriptorAccessed()
INTERNAL: Clear the the lastDescriptorAccessed cache.
-
clearDescriptors
public void clearDescriptors()
INTERNAL: Clear the the descriptors cache.
-
clearProfile
public void clearProfile()
PUBLIC: Clear the profiler, this will end the current profile operation.- Specified by:
clearProfile
in interfaceSession
-
commitExternalTransaction
public boolean commitExternalTransaction()
INTERNAL: Attempts to commit the running internally started external transaction. Returns true only in one case - external transaction has been internally committed during this method call: wasJTSTransactionInternallyStarted()==true in the beginning of this method and wasJTSTransactionInternallyStarted()==false in the end of this method.
-
commitTransaction
public void commitTransaction() throws DatabaseException, ConcurrencyException
PUBLIC: Commit the active database transaction. This allows a group of database modification to be committed or rolled back as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.- Throws:
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.
-
compareObjects
public boolean compareObjects(Object firstObject, Object secondObject)
INTERNAL: Return if the two object match completely. This checks the objects attributes and their private parts.
-
compareObjectsDontMatch
public boolean compareObjectsDontMatch(Object firstObject, Object secondObject)
TESTING: Return true if the object do not match. This checks the objects attributes and their private parts.
-
containsQuery
public boolean containsQuery(String queryName)
PUBLIC: Return true if the pre-defined query is defined on the session.- Specified by:
containsQuery
in interfaceSession
-
copy
public Object copy(Object originalObjectOrObjects)
PUBLIC: Return a complete copy of the object or of collection of objects. In case of collection all members should be either entities of the same type or have a common inheritance hierarchy mapped root class. This can be used to obtain a scratch copy of an object, or for templatizing an existing object into another new object. The object and all of its privately owned parts will be copied.- Specified by:
copy
in interfaceSession
- See Also:
copy(Object, AttributeGroup)
-
copy
public Object copy(Object originalObjectOrObjects, AttributeGroup group)
PUBLIC: Return a complete copy of the object or of collection of objects. In case of collection all members should be either entities of the same type or have a common inheritance hierarchy mapped root class. This can be used to obtain a scratch copy of an object, or for templatizing an existing object into another new object. If there are no attributes in the group then the object and all of its privately owned parts will be copied. Otherwise only the attributes included into the group will be copied.
-
copyReadOnlyClasses
public Vector copyReadOnlyClasses()
INTERNAL: Copy the read only classes from the unit of work Added Nov 8, 2000 JED for Patch 2.5.1.8 Ref: Prs 24502
-
createCloneQueryValueHolder
public DatabaseValueHolder createCloneQueryValueHolder(ValueHolderInterface attributeValue, Object clone, AbstractRecord row, ForeignReferenceMapping mapping)
-
createCloneTransformationValueHolder
public DatabaseValueHolder createCloneTransformationValueHolder(ValueHolderInterface attributeValue, Object original, Object clone, AbstractTransformationMapping mapping)
-
createInjectionManager
public <T> InjectionManager<T> createInjectionManager(Object beanManager)
-
createProtectedInstanceFromCachedData
public Object createProtectedInstanceFromCachedData(Object cached, Integer refreshCascade, ClassDescriptor descriptor)
INTERNAL: This method is similar to getAndCloneCacheKeyFromParent. It purpose is to get protected cache data from the shared cache and build/return a protected instance.
-
checkAndRefreshInvalidObject
public void checkAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor)
INTERNAL: Check if the object is invalid and refresh it. This is used to ensure that no invalid objects are registered.
-
isConsideredInvalid
public boolean isConsideredInvalid(Object object, CacheKey cacheKey, ClassDescriptor descriptor)
INTERNAL: Check if the object is invalid and *should* be refreshed. This is used to ensure that no invalid objects are cloned.
-
deferEvent
public void deferEvent(DescriptorEvent event)
INTERNAL: Add an event to the deferred list. Events will be fired after the operation completes
-
deleteAllObjects
public void deleteAllObjects(Collection domainObjects) throws DatabaseException, OptimisticLockException
PUBLIC: delete all of the objects and all of their privately owned parts in the database. The allows for a group of objects to be deleted as a unit. The objects will be deleted through a single transactions.- Throws:
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.
-
deleteObject
public Object deleteObject(Object domainObject) throws DatabaseException, OptimisticLockException
PUBLIC: Delete the object and all of its privately owned parts from the database. The delete operation can be customized through using a delete query.- Throws:
DatabaseException
- if an error occurs on the database, these include constraint violations, security violations and general database errors. An database error is not raised if the object is already deleted or no rows are effected.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.- See Also:
DeleteObjectQuery
-
doesObjectExist
public boolean doesObjectExist(Object object) throws DatabaseException
PUBLIC: Return if the object exists on the database or not. This always checks existence on the database.- Specified by:
doesObjectExist
in interfaceSession
- Throws:
DatabaseException
-
dontLogMessages
public void dontLogMessages()
PUBLIC: Turn off logging- Specified by:
dontLogMessages
in interfaceSession
-
endOperationProfile
public void endOperationProfile(String operationName)
INTERNAL: End the operation timing.- Specified by:
endOperationProfile
in interfaceCommandProcessor
-
endOperationProfile
public void endOperationProfile(String operationName, DatabaseQuery query, int weight)
INTERNAL: End the operation timing.
-
updateProfile
public void updateProfile(String operationName, Object value)
INTERNAL: Updates the value of SessionProfiler state- Specified by:
updateProfile
in interfaceCommandProcessor
-
updateTablePerTenantDescriptors
public void updateTablePerTenantDescriptors(String property, Object value)
INTERNAL: Set the table per tenant. This should be called per client session after the start of a transaction. From JPA this method is called on the entity manager by setting the multitenant table per tenant property.
-
incrementProfile
public void incrementProfile(String operationName)
INTERNAL: Updates the count of SessionProfiler event- Specified by:
incrementProfile
in interfaceCommandProcessor
-
incrementProfile
public void incrementProfile(String operationName, DatabaseQuery query)
INTERNAL: Updates the count of SessionProfiler event
-
executeDeferredEvents
public void executeDeferredEvents()
INTERNAL: Causes any deferred events to be fired. Called after operation completes
-
executeCall
public Object executeCall(Call call, AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
INTERNAL: Overridden by subclasses that do more than just execute the call. Executes the call directly on this session and does not check which session it should have executed on.- Throws:
DatabaseException
-
releaseConnectionAfterCall
public void releaseConnectionAfterCall(DatabaseQuery query)
INTERNAL: Release (if required) connection after call.- Parameters:
query
-
-
executeNonSelectingCall
public int executeNonSelectingCall(Call call) throws DatabaseException
PUBLIC: Execute the call on the database. The row count is returned. The call can be a stored procedure call, SQL call or other type of call.Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee");
- Specified by:
executeNonSelectingCall
in interfaceSession
- Throws:
DatabaseException
- See Also:
executeSelectingCall(Call)
-
executeNonSelectingSQL
public void executeNonSelectingSQL(String sqlString) throws DatabaseException
PUBLIC: Execute the sql on the database.Example:
session.executeNonSelectingSQL("Delete from Employee");
- Specified by:
executeNonSelectingSQL
in interfaceSession
- Throws:
DatabaseException
- See Also:
Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.
-
executeQuery
public Object executeQuery(String queryName) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass, Object arg1) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass, Object arg1, Object arg2) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass, Object arg1, Object arg2, Object arg3) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass, List argumentValues) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Class domainClass, Vector argumentValues) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.- Throws:
DatabaseException
- See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Object arg1) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Object arg1, Object arg2) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Object arg1, Object arg2, Object arg3) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, List argumentValues) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(String queryName, Vector argumentValues) throws DatabaseException
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- Throws:
DatabaseException
- See Also:
addQuery(String, DatabaseQuery)
-
executeQuery
public Object executeQuery(DatabaseQuery query) throws DatabaseException
PUBLIC: Execute the database query. A query is a database operation such as reading or writing. The query allows for the operation to be customized for such things as, performance, depth, caching, etc.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
- See Also:
DatabaseQuery
-
executeQuery
public Object executeQuery(DatabaseQuery query, List argumentValues) throws DatabaseException
PUBLIC: Return the results from executing the database query. The query arguments are passed in as a List of argument values in the same order as the query arguments.- Specified by:
executeQuery
in interfaceSession
- Throws:
DatabaseException
-
executeQuery
public Object executeQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException
INTERNAL: Return the results from executing the database query. the arguments should be a database row with raw data values.- Throws:
DatabaseException
-
executeQuery
public Object executeQuery(DatabaseQuery query, AbstractRecord row, int retryCount) throws DatabaseException
INTERNAL: Return the results from executing the database query. the arguments should be a database row with raw data values.- Throws:
DatabaseException
-
retryQuery
public Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
INTERNAL: A query execution failed due to an invalid query. Re-connect and retry the query.
-
executeSelectingCall
public Vector executeSelectingCall(Call call) throws DatabaseException
PUBLIC: Execute the call on the database and return the result. The call must return a value, if no value is return executeNonSelectCall must be used. The call can be a stored procedure call, SQL call or other type of call. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
- Specified by:
executeSelectingCall
in interfaceSession
- Throws:
DatabaseException
- See Also:
executeNonSelectingCall(Call)
-
executeSQL
public Vector executeSQL(String sqlString) throws DatabaseException
PUBLIC: Execute the sql on the database and return the result. It must return a value, if no value is return executeNonSelectingSQL must be used. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.Example:
session.executeSelectingCall("Select * from Employee");
- Specified by:
executeSQL
in interfaceSession
- Throws:
DatabaseException
- See Also:
executeSelectingCall(Call)
-
getAccessor
public Accessor getAccessor()
INTERNAL: This should normally not be used, most sessions do not have a single accessor. ServerSession has a set of connection pools. ClientSession only has an accessor during a transaction. SessionBroker has multiple accessors. getAccessors() should be used to support partitioning. To maintain backward compatibility, and to support certain cases that required a default accessor, this returns the first accessor.
-
getAccessors
public Collection<Accessor> getAccessors()
INTERNAL: This should normally not be used, most sessions do not have specific accessors. ServerSession has a set of connection pools. ClientSession only has an accessor during a transaction. SessionBroker has multiple accessors. getAccessors() is used to support partitioning. If the accessor is null, this lazy initializes one for backwardcompatibility with DatabaseSession.
-
getAccessors
public Collection<Accessor> getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)
INTERNAL: Return the connections to use for the query execution.
-
basicExecuteCall
public Object basicExecuteCall(Call call, AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
INTERNAL: Execute the call on each accessors and merge the results.- Throws:
DatabaseException
-
getActiveCommandThreads
public ExposedNodeLinkedList getActiveCommandThreads()
INTERNAL:
-
getActiveSession
public Session getActiveSession()
PUBLIC: Return the active session for the current active external (JTS) transaction. This should only be used with JTS and will return the session if no external transaction exists.- Specified by:
getActiveSession
in interfaceSession
-
getActiveUnitOfWork
public UnitOfWork getActiveUnitOfWork()
PUBLIC: Return the active unit of work for the current active external (JTS) transaction. This should only be used with JTS and will return null if no external transaction exists.- Specified by:
getActiveUnitOfWork
in interfaceSession
-
getAliasDescriptors
public Map getAliasDescriptors()
INTERNAL: Returns the alias descriptors Map.
-
getAsOfClause
public AsOfClause getAsOfClause()
ADVANCED: Answers the past time this session is as of. Indicates whether or not this is a special historical session where all objects are read relative to a particular point in time.- Specified by:
getAsOfClause
in interfaceSession
- Returns:
- An immutable object representation of the past time.
null
if no clause set, or this a regular session. - See Also:
acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause)
-
getBroker
public AbstractSession getBroker()
INTERNAL: Allow the session to be used from a session broker.
-
getRootSession
public AbstractSession getRootSession(DatabaseQuery query)
INTERNAL: The session that this query is executed against when not in transaction. The session containing the shared identity map.In most cases this is the root ServerSession or DatabaseSession.
In cases where objects are not to be cached in the global identity map an alternate session may be returned:
- A ClientSession if in transaction
- An isolated ClientSession or HistoricalSession
- A registered session of a root SessionBroker
-
getParent
public AbstractSession getParent()
INTERNAL: Gets the parent session.
-
getParentIdentityMapSession
public AbstractSession getParentIdentityMapSession(DatabaseQuery query)
INTERNAL: Gets the next link in the chain of sessions followed by a query's check early return, the chain of sessions with identity maps all the way up to the root session.
-
getParentIdentityMapSession
public AbstractSession getParentIdentityMapSession(DatabaseQuery query, boolean canReturnSelf, boolean terminalOnly)
INTERNAL: Gets the next link in the chain of sessions followed by a query's check early return, the chain of sessions with identity maps all the way up to the root session.Used for session broker which delegates to registered sessions, or UnitOfWork which checks parent identity map also.
- Parameters:
canReturnSelf
- true when method calls itself. If the path starting atthis
is acceptable. Sometimes true if want to move to the first valid session, i.e. executing on ClientSession when really should be on ServerSession.terminalOnly
- return the session we will execute the call on, not the next step towards it.- Returns:
- this if there is no next link in the chain
-
getParentIdentityMapSession
public AbstractSession getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)
INTERNAL: Returns the appropriate IdentityMap session for this descriptor. Sessions can be chained and each session can have its own Cache/IdentityMap. Entities can be stored at different levels based on Cache Isolation. This method will return the correct Session for a particular Entity class based on the Isolation Level and the attributes provided.- Parameters:
canReturnSelf
- true when method calls itself. If the path starting atthis
is acceptable. Sometimes true if want to move to the first valid session, i.e. executing on ClientSession when really should be on ServerSession.terminalOnly
- return the last session in the chain where the Enitity is stored.- Returns:
- Session with the required IdentityMap
-
getPessimisticLockTimeoutDefault
public Integer getPessimisticLockTimeoutDefault()
INTERNAL: Returns the default pessimistic lock timeout value.
-
getPessimisticLockTimeoutUnitDefault
public TimeUnit getPessimisticLockTimeoutUnitDefault()
-
getQueryTimeoutDefault
public int getQueryTimeoutDefault()
PUBLIC: Return the default query timeout for this session. This timeout will apply to any queries that do not have a timeout set, and that do not have a default timeout defined in their descriptor.
-
getQueryTimeoutUnitDefault
public TimeUnit getQueryTimeoutUnitDefault()
-
getInjectionManager
public <T> InjectionManager<T> getInjectionManager()
-
getExecutionSession
public AbstractSession getExecutionSession(DatabaseQuery query)
INTERNAL: Gets the session which this query will be executed on. Generally will be called immediately before the call is translated, which is immediately before session.executeCall.Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.
Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.
- Parameters:
query
- may store session name or reference class for brokers case- Returns:
- a session with a live accessor
-
hasCommitManager
public boolean hasCommitManager()
INTERNAL: Return if the commit manager has been set.
-
getCommitManager
public CommitManager getCommitManager()
INTERNAL: The commit manager is used to resolve referential integrity on commits of multiple objects. All brokered sessions share the same commit manager.
-
getDefaultReadOnlyClasses
public Vector getDefaultReadOnlyClasses()
INTERNAL: Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.
-
getClassDescriptor
public ClassDescriptor getClassDescriptor(Class theClass)
ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class. If a descriptor does not exist for the Class parameter, null is returned. If the passed Class parameter is null, then null will be returned.- Specified by:
getClassDescriptor
in interfaceSession
-
getClassDescriptor
public ClassDescriptor getClassDescriptor(Object domainObject)
ADVANCED: Return the descriptor specified for the object's class. If a descriptor does not exist for the Object parameter, null is returned. If the passed Object parameter is null, then null will be returned.- Specified by:
getClassDescriptor
in interfaceSession
-
getClassDescriptorForAlias
public ClassDescriptor getClassDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias. UnitOfWork delegates this to the parent- Specified by:
getClassDescriptorForAlias
in interfaceSession
-
getDescriptor
public ClassDescriptor getDescriptor(Class theClass)
ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class. If the passed Class is null, null will be returned.- Specified by:
getDescriptor
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getDescriptor
in interfaceSession
-
getDescriptor
public ClassDescriptor getDescriptor(Object domainObject)
ADVANCED: Return the descriptor specified for the object's class. If the passed Object is null, null will be returned.- Specified by:
getDescriptor
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getDescriptor
in interfaceSession
-
getDescriptorForAlias
public ClassDescriptor getDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias.- Specified by:
getDescriptorForAlias
in interfaceSession
- Parameters:
alias
- The descriptor alias.- Returns:
- The descriptor for the alias or
null
if no descriptor was found.
-
getDescriptors
public Map<Class,ClassDescriptor> getDescriptors()
ADVANCED: Return all registered descriptors.- Specified by:
getDescriptors
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getDescriptors
in interfaceSession
- Specified by:
getDescriptors
in classCoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
-
hasEventManager
public boolean hasEventManager()
INTERNAL: Return if an event manager has been set.
-
getEventManager
public SessionEventManager getEventManager()
PUBLIC: Return the event manager. The event manager can be used to register for various session events.- Specified by:
getEventManager
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getEventManager
in interfaceSession
-
getExceptionHandlerClass
public String getExceptionHandlerClass()
INTERNAL: Return a string which represents my ExceptionHandler's class Added for F2104: Properties.xml - gn
-
getExceptionHandler
public ExceptionHandler getExceptionHandler()
PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.- Specified by:
getExceptionHandler
in interfaceSession
-
getExternalTransactionController
public ExternalTransactionController getExternalTransactionController()
PUBLIC: Used for JTS integration. If your application requires to have JTS control transactions instead of EclipseLink an external transaction controller must be specified. EclipseLink provides JTS controllers for several JTS implementations including JTS 1.0, Weblogic 5.1 and WebSphere 3.0.- Specified by:
getExternalTransactionController
in interfaceSession
- See Also:
JTATransactionController
-
getIdentityMapAccessor
public IdentityMapAccessor getIdentityMapAccessor()
PUBLIC: The IdentityMapAccessor is the preferred way of accessing IdentityMap funcitons This will return an object which implements an interface which exposes all public IdentityMap functions.- Specified by:
getIdentityMapAccessor
in interfaceSession
-
getIdentityMapAccessorInstance
public IdentityMapAccessor getIdentityMapAccessorInstance()
INTERNAL: Return the internally available IdentityMapAccessor instance.
-
getIntegrityChecker
public IntegrityChecker getIntegrityChecker()
PUBLIC: Returns the integrityChecker.IntegrityChecker holds all the ClassDescriptor Exceptions.- Specified by:
getIntegrityChecker
in interfaceSession
-
getJPAQueries
public List<DatabaseQuery> getJPAQueries()
ADVANCED: Return all pre-defined not yet parsed JPQL queries.- Specified by:
getJPAQueries
in interfaceSession
-
getJPATablePerTenantQueries
public List<DatabaseQuery> getJPATablePerTenantQueries()
ADVANCED: Return all pre-defined not yet parsed JPQL queries.
-
getLog
public Writer getLog()
PUBLIC: Return the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging, logMessages must be turned on.- Specified by:
getLog
in interfaceSession
- See Also:
setLoggingOff(boolean)
-
getLogSessionString
public String getLogSessionString()
INTERNAL: Return the name of the session: class name + system hashcode.This should be the implementation of toString(), and also the value should be calculated in the constructor for it is used all the time. However everything is lazily initialized now and the value is transient for the system hashcode could vary?
-
getSessionTypeString
public String getSessionTypeString()
INTERNAL: Returns the type of session, its class.Override to hide from the user when they are using an internal subclass of a known class.
A user does not need to know that their UnitOfWork is a non-deferred UnitOfWork, or that their ClientSession is an IsolatedClientSession.
-
getStaticMetamodelClass
public String getStaticMetamodelClass(String modelClassName)
INTERNAL: Return the static metamodel class associated with the given model class if available. Callers must handle null.
-
getLogin
public DatabaseLogin getLogin()
OBSOLETE: Return the login, the login holds any database connection information given. This has been replaced by getDatasourceLogin to make use of the Login interface to support non-relational datasources, if DatabaseLogin API is required it will need to be cast.
-
getDatasourceLogin
public Login getDatasourceLogin()
PUBLIC: Return the login, the login holds any database connection information given. This return the Login interface and may need to be cast to the datasource specific implementation.- Specified by:
getDatasourceLogin
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getDatasourceLogin
in interfaceSession
-
getMappedSuperclass
public ClassDescriptor getMappedSuperclass(String className)
INTERNAL: Return the mapped superclass descriptor if one exists for the given class name. Must check any broker as well.
-
getMultitenantContextProperties
public Set<String> getMultitenantContextProperties()
PUBLIC: Return a set of multitenant context properties this session
-
getName
public String getName()
PUBLIC: Return the name of the session. This is used with the session broker, or to give the session a more meaningful name.
-
getNextSequenceNumberValue
public Number getNextSequenceNumberValue(Class domainClass)
ADVANCED: Return the sequnce number from the database- Specified by:
getNextSequenceNumberValue
in interfaceSession
-
getNumberOfActiveUnitsOfWork
public int getNumberOfActiveUnitsOfWork()
INTERNAL: Return the number of units of work connected.
-
getCacheKeyFromTargetSessionForMerge
protected CacheKey getCacheKeyFromTargetSessionForMerge(Object implementation, ObjectBuilder builder, ClassDescriptor descriptor, MergeManager mergeManager)
INTERNAL: For use within the merge process this method will get an object from the shared cache using a readlock. If a readlock is unavailable then the merge manager will be transitioned to deferred locks and a deferred lock will be used.
-
getPlatform
public DatabasePlatform getPlatform()
INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior. NOTE: this must only be used for relational specific usage, it will fail for non-relational datasources.- Specified by:
getPlatform
in interfaceSession
-
getLoader
public ClassLoader getLoader()
INTERNAL: Return the class loader for the session's application. This loader should be able to load any application or EclipseLink class.
-
getDatasourcePlatform
public Platform getDatasourcePlatform()
INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior.- Specified by:
getDatasourcePlatform
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getDatasourcePlatform
in interfaceSession
- Specified by:
getDatasourcePlatform
in classCoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
-
getServerPlatform
public ServerPlatform getServerPlatform()
INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within EclipseLink's other sessions types (ie not DatabaseSession)- Specified by:
getServerPlatform
in interfaceSession
-
getPlatform
public Platform getPlatform(Class domainClass)
INTERNAL: Return the database platform currently connected to for specified class. The platform is used for database specific behavior.- Specified by:
getPlatform
in classCoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
-
getProfiler
public SessionProfiler getProfiler()
PUBLIC: Return the profiler. The profiler is a tool that can be used to determine performance bottlenecks. The profiler can be queries to print summaries and configure for logging purposes.- Specified by:
getProfiler
in interfaceSession
-
getProject
public Project getProject()
PUBLIC: Return the project, the project holds configuartion information including the descriptors.- Specified by:
getProject
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
getProject
in interfaceSession
-
getProperties
public Map<String,Object> getProperties()
ADVANCED: Allow for user defined properties.- Specified by:
getProperties
in interfaceSession
-
hasProperties
public boolean hasProperties()
INTERNAL: Allow to check for user defined properties.
-
hasTablePerTenantDescriptors
public boolean hasTablePerTenantDescriptors()
INTERNAL: Return list of table per tenant multitenant descriptors.
-
hasTablePerTenantQueries
public boolean hasTablePerTenantQueries()
INTERNAL: Return a list of table per tenant multitenant queries.
-
getProperty
public Object getProperty(String name)
ADVANCED: Returns the user defined property.- Specified by:
getProperty
in interfaceSession
-
getQueries
public Map<String,List<DatabaseQuery>> getQueries()
ADVANCED: Return all pre-defined queries.- Specified by:
getQueries
in interfaceSession
-
getAttributeGroups
public Map<String,AttributeGroup> getAttributeGroups()
ADVANCED Return all predefined attribute groups
-
getAllQueries
public List<DatabaseQuery> getAllQueries()
INTERNAL: Return the pre-defined queries in this session. A single vector containing all the queries is returned.- See Also:
getQueries()
-
getQuery
public DatabaseQuery getQuery(String name)
PUBLIC: Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
-
getQuery
public DatabaseQuery getQuery(String name, List arguments)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments.- Specified by:
getQuery
in interfaceSession
- See Also:
getQuery(String)
-
getQuery
public DatabaseQuery getQuery(String name, Vector arguments)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments.- See Also:
getQuery(String)
-
getQuery
public DatabaseQuery getQuery(String name, Vector arguments, boolean shouldSearchParent)
INTERNAL: Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments.- Parameters:
shouldSearchParent
- indicates whether parent should be searched if query not found.- See Also:
getQuery(String, List)
-
getSequencing
public Sequencing getSequencing()
INTERNAL: Return the Sequencing object used by the session.
-
getSessionForClass
public AbstractSession getSessionForClass(Class domainClass)
INTERNAL: Return the session to be used for the class. Used for compatibility with the session broker.
-
getSessionForName
public AbstractSession getSessionForName(String name) throws ValidationException
INTERNAL: Return the session by name. Used for compatibility with the session broker.- Throws:
ValidationException
-
getSessionLog
public SessionLog getSessionLog()
PUBLIC: Return the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, logMessages must be turned on.- Specified by:
getSessionLog
in interfaceSession
- See Also:
setLoggingOff(boolean)
-
getTablePerTenantDescriptors
public List<ClassDescriptor> getTablePerTenantDescriptors()
INTERNAL: Return list of table per tenant multitenant descriptors.
-
getTablePerTenantQueries
public List<DatabaseQuery> getTablePerTenantQueries()
INTERNAL: Return list of table per tenant multitenant descriptors.
-
getTransactionMutex
public ConcurrencyManager getTransactionMutex()
INTERNAL: The transaction mutex ensure mutual exclusion on transaction across multiple threads.
-
handleException
public Object handleException(RuntimeException exception) throws RuntimeException
PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.- Specified by:
handleException
in interfaceCommandProcessor
- Specified by:
handleException
in interfaceSession
- Parameters:
exception
- The exception being thrown- Returns:
- An object that is not currently used
- Throws:
RuntimeException
-
hasBroker
public boolean hasBroker()
INTERNAL: Allow the session to be used from a session broker.
-
hasDescriptor
public boolean hasDescriptor(Class theClass)
ADVANCED: Return true if a descriptor exists for the given class.- Specified by:
hasDescriptor
in interfaceSession
-
hasExceptionHandler
public boolean hasExceptionHandler()
PUBLIC: Return if an exception handler is present.- Specified by:
hasExceptionHandler
in interfaceSession
-
hasExternalTransactionController
public boolean hasExternalTransactionController()
PUBLIC: Used for JTA integration. If your application requires to have JTA control transactions instead of EclipseLink an external transaction controler must be specified. EclipseLink provides JTA controlers for JTA 1.0 and application servers.- Specified by:
hasExternalTransactionController
in interfaceSession
- See Also:
JTATransactionController
-
initializeIdentityMapAccessor
public void initializeIdentityMapAccessor()
INTERNAL: Set up the IdentityMapManager. This method allows subclasses of Session to override the default IdentityMapManager functionality.
-
insertObject
public Object insertObject(Object domainObject) throws DatabaseException
PUBLIC: Insert the object and all of its privately owned parts into the database. Insert should only be used if the application knows that the object is new, otherwise writeObject should be used. The insert operation can be customized through using an insert query.- Throws:
DatabaseException
- if an error occurs on the database, these include constraint violations, security violations and general database errors.- See Also:
InsertObjectQuery
,writeObject(Object)
-
internalExecuteQuery
public Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException
INTERNAL: Return the results from exeucting the database query. The arguments should be a database row with raw data values. This method is provided to allow subclasses to change the default querying behavior. All querying goes through this method.- Throws:
DatabaseException
-
isBroker
public boolean isBroker()
INTERNAL: Returns true if the session is a session Broker.
-
isInBroker
public boolean isInBroker()
INTERNAL: Returns true if the session is in a session Broker.
-
isClassReadOnly
public boolean isClassReadOnly(Class theClass)
PUBLIC: Return if the class is defined as read-only.
-
isClassReadOnly
public boolean isClassReadOnly(Class theClass, ClassDescriptor descriptor)
INTERNAL: Return if the class is defined as read-only. PERF: Pass descriptor to avoid re-lookup.
-
isClientSession
public boolean isClientSession()
PUBLIC: Return if this session is a client session.- Specified by:
isClientSession
in interfaceSession
-
isIsolatedClientSession
public boolean isIsolatedClientSession()
PUBLIC: Return if this session is an isolated client session.
-
isExclusiveIsolatedClientSession
public boolean isExclusiveIsolatedClientSession()
PUBLIC: Return if this session is an exclusive isolated client session.
-
isConnected
public boolean isConnected()
PUBLIC: Return if this session is connected to the database.- Specified by:
isConnected
in interfaceSession
-
isDatabaseSession
public boolean isDatabaseSession()
PUBLIC: Return if this session is a database session.- Specified by:
isDatabaseSession
in interfaceSession
-
isDistributedSession
public boolean isDistributedSession()
PUBLIC: Return if this session is a distributed session.- Specified by:
isDistributedSession
in interfaceSession
-
isInProfile
public boolean isInProfile()
PUBLIC: Return if a profiler is being used.- Specified by:
isInProfile
in interfaceSession
-
setIsInProfile
public void setIsInProfile(boolean inProfile)
PUBLIC: Allow for user deactive a profiler
-
setIsInBroker
public void setIsInBroker(boolean isInBroker)
INTERNAL: Set if this session is contained in a SessionBroker.
-
isFinalizersEnabled
public boolean isFinalizersEnabled()
PUBLIC: Return if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons.- Specified by:
isFinalizersEnabled
in interfaceSession
-
registerFinalizer
public void registerFinalizer()
INTERNAL: Register a finalizer to release this session.
-
isHistoricalSession
public boolean isHistoricalSession()
INTERNAL: Return if this session is a historical session.
-
setIsFinalizersEnabled
public void setIsFinalizersEnabled(boolean isFinalizersEnabled)
PUBLIC: Set if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons.- Specified by:
setIsFinalizersEnabled
in interfaceSession
-
isInTransaction
public boolean isInTransaction()
PUBLIC: Return if the session is currently in the progress of a database transaction. Because nested transactions are allowed check if the transaction mutex has been aquired.
-
isJPAQueriesProcessed
public boolean isJPAQueriesProcessed()
INTERNAL: used to see if JPA Queries have been processed during initialization
-
isProtectedSession
public boolean isProtectedSession()
PUBLIC: Returns true if Protected Entities should be built within this session
-
isRemoteSession
public boolean isRemoteSession()
PUBLIC: Return if this session is remote.- Specified by:
isRemoteSession
in interfaceSession
-
isRemoteUnitOfWork
public boolean isRemoteUnitOfWork()
PUBLIC: Return if this session is a unit of work.- Specified by:
isRemoteUnitOfWork
in interfaceSession
-
isServerSession
public boolean isServerSession()
PUBLIC: Return if this session is a server session.- Specified by:
isServerSession
in interfaceSession
-
isSessionBroker
public boolean isSessionBroker()
PUBLIC: Return if this session is a session broker.- Specified by:
isSessionBroker
in interfaceSession
-
isSynchronized
public boolean isSynchronized()
INTERNAL: Return if this session is synchronized.
-
isUnitOfWork
public boolean isUnitOfWork()
PUBLIC: Return if this session is a unit of work.- Specified by:
isUnitOfWork
in interfaceSession
-
getId
public Object getId(Object domainObject) throws ValidationException
ADVANCED: Extract and return the primary key from the object.- Specified by:
getId
in interfaceSession
- Throws:
ValidationException
-
keyFromObject
public Object keyFromObject(Object domainObject, ClassDescriptor descriptor) throws ValidationException
ADVANCED: Extract and return the primary key from the object.- Throws:
ValidationException
-
log
public void log(SessionLogEntry entry)
PUBLIC: Log the log entry.
-
logMessage
public void logMessage(String message)
Log a untranslated message to the EclipseLink log at FINER level.- Specified by:
logMessage
in interfaceSession
-
prepareDatabaseQuery
public DatabaseQuery prepareDatabaseQuery(DatabaseQuery query)
INTERNAL: A call back to do session specific preparation of a query.The call back occurs soon before we clone the query for execution, meaning that if this method needs to clone the query then the caller will determine that it doesn't need to clone the query itself.
-
readAllObjects
public Vector readAllObjects(Class domainClass) throws DatabaseException
PUBLIC: Read all of the instances of the class from the database. This operation can be customized through using a ReadAllQuery, or through also passing in a selection criteria.- Specified by:
readAllObjects
in interfaceSession
- Throws:
DatabaseException
- See Also:
ReadAllQuery
,readAllObjects(Class, Expression)
-
readAllObjects
public Vector readAllObjects(Class domainClass, String sqlString) throws DatabaseException
PUBLIC: Read all of the instances of the class from the database return through execution the SQL string. The SQL string must be a valid SQL select statement or selecting stored procedure call. This operation can be customized through using a ReadAllQuery. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.- Throws:
DatabaseException
- See Also:
ReadAllQuery
-
readAllObjects
public Vector readAllObjects(Class referenceClass, Call aCall) throws DatabaseException
PUBLIC: Read all the instances of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));- Specified by:
readAllObjects
in interfaceSession
- Throws:
DatabaseException
- See Also:
Call
-
readAllObjects
public Vector readAllObjects(Class domainClass, Expression expression) throws DatabaseException
PUBLIC: Read all of the instances of the class from the database matching the given expression. This operation can be customized through using a ReadAllQuery.- Specified by:
readAllObjects
in interfaceSession
- Throws:
DatabaseException
- See Also:
ReadAllQuery
-
readObject
public Object readObject(Class domainClass) throws DatabaseException
PUBLIC: Read the first instance of the class from the database. This operation can be customized through using a ReadObjectQuery, or through also passing in a selection criteria.- Specified by:
readObject
in interfaceSession
- Throws:
DatabaseException
- See Also:
ReadObjectQuery
,readAllObjects(Class, Expression)
-
readObject
public Object readObject(Class domainClass, String sqlString) throws DatabaseException
PUBLIC: Read the first instance of the class from the database return through execution the SQL string. The SQL string must be a valid SQL select statement or selecting stored procedure call. This operation can be customized through using a ReadObjectQuery. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.- Throws:
DatabaseException
- See Also:
ReadObjectQuery
-
readObject
public Object readObject(Class domainClass, Call aCall) throws DatabaseException
PUBLIC: Read the first instance of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));- Specified by:
readObject
in interfaceSession
- Throws:
DatabaseException
- See Also:
SQLCall
,JPQLCall
-
readObject
public Object readObject(Class domainClass, Expression expression) throws DatabaseException
PUBLIC: Read the first instance of the class from the database matching the given expression. This operation can be customized through using a ReadObjectQuery.- Specified by:
readObject
in interfaceSession
- Throws:
DatabaseException
- See Also:
ReadObjectQuery
-
readObject
public Object readObject(Object object) throws DatabaseException
PUBLIC: Use the example object to consruct a read object query by the objects primary key. This will read the object from the database with the same primary key as the object or null if no object is found.- Specified by:
readObject
in interfaceSession
- Throws:
DatabaseException
-
refreshAndLockObject
public Object refreshAndLockObject(Object object) throws DatabaseException
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. The object will be pessimisticly locked on the database for the duration of the transaction. If the object is already locked this method will wait until the lock is released. A no wait option is available through setting the lock mode.- Throws:
DatabaseException
- See Also:
refreshAndLockObject(Object, short)
-
refreshAndLockObject
public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. The object will be pessimisticly locked on the database for the duration of the transaction.Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT
- Throws:
DatabaseException
-
refreshObject
public Object refreshObject(Object object) throws DatabaseException
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. This can be used to ensure the object is up to date with the database. Caution should be used when using this to make sure the application has no un commited changes to the object.- Specified by:
refreshObject
in interfaceSession
- Throws:
DatabaseException
-
release
public void release()
PUBLIC: Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something.
-
releaseUnitOfWork
public void releaseUnitOfWork(UnitOfWorkImpl unitOfWork)
INTERNAL: Release the unit of work, if lazy release the connection.
-
removeProperty
public void removeProperty(String property)
PUBLIC: Remove the user defined property.- Specified by:
removeProperty
in interfaceSession
-
removeQuery
public void removeQuery(String queryName)
PUBLIC: Remove all queries with the given queryName regardless of the argument types.- Specified by:
removeQuery
in interfaceSession
- See Also:
removeQuery(String, Vector)
-
removeQuery
public void removeQuery(String queryName, Vector argumentTypes)
PUBLIC: Remove the specific query with the given queryName and argumentTypes.
-
rollbackExternalTransaction
protected boolean rollbackExternalTransaction()
PROTECTED: Attempts to rollback the running internally started external transaction. Returns true only in one case - extenal transaction has been internally rolled back during this method call: wasJTSTransactionInternallyStarted()==true in the beginning of this method and wasJTSTransactionInternallyStarted()==false in the end of this method.
-
rollbackTransaction
public void rollbackTransaction() throws DatabaseException, ConcurrencyException
PUBLIC: Rollback the active database transaction. This allows a group of database modification to be commited or rolledback as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.- Throws:
DatabaseException
- if the database connection is lost or the rollback fails.ConcurrencyException
- if this session is not within a transaction.
-
setAccessor
public void setAccessor(Accessor accessor)
INTERNAL: Set the accessor.
-
setBroker
public void setBroker(AbstractSession broker)
INTERNAL: Allow the session to be used from a session broker.
-
setCommitManager
public void setCommitManager(CommitManager commitManager)
INTERNAL: The commit manager is used to resolve referncial integrity on commits of multiple objects.
-
setInjectionManager
public void setInjectionManager(InjectionManager injectionManager)
-
setEventManager
public void setEventManager(SessionEventManager eventManager)
INTERNAL: Set the event manager. The event manager can be used to register for various session events.
-
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
PUBLIC: Set the exceptionHandler. Exception handler can catch errors that occur on queries or during database access.- Specified by:
setExceptionHandler
in interfaceSession
-
setExternalTransactionController
public void setExternalTransactionController(ExternalTransactionController externalTransactionController)
Used for JTS integration internally by ServerPlatform.- Specified by:
setExternalTransactionController
in interfaceSession
- See Also:
CustomServerPlatform
-
setIntegrityChecker
public void setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC: set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.- Specified by:
setIntegrityChecker
in interfaceSession
-
setJPAQueriesProcessed
public void setJPAQueriesProcessed(boolean jpaQueriesProcessed)
INTERNAL: used to set if JPA Queries have been processed during initialization
-
setLog
public void setLog(Writer log)
PUBLIC: Set the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging logMessages() is used.- Specified by:
setLog
in interfaceSession
- See Also:
setLoggingOff(boolean)
-
setLogin
public void setLogin(DatabaseLogin login)
PUBLIC: Set the login.
-
setLogin
public void setLogin(Login login)
PUBLIC: Set the login.
-
setDatasourceLogin
public void setDatasourceLogin(Login login)
PUBLIC: Set the login.
-
setName
public void setName(String name)
PUBLIC: Set the name of the session. This is used with the session broker.
-
setNumberOfActiveUnitsOfWork
protected void setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)
-
setPessimisticLockTimeoutDefault
public void setPessimisticLockTimeoutDefault(Integer pessimisticLockTimeoutDefault)
PUBLIC: Set the default pessimistic lock timeout value. This value will be used to set the WAIT clause of a SQL SELECT FOR UPDATE statement. It defines how long EcliseLink should wait for a lock on the database row before aborting.
-
setPessimisticLockTimeoutUnitDefault
public void setPessimisticLockTimeoutUnitDefault(TimeUnit pessimisticLockTimeoutUnitDefault)
-
setQueryTimeoutDefault
public void setQueryTimeoutDefault(int queryTimeoutDefault)
PUBLIC: Set the default query timeout for this session. This timeout will apply to any queries that do not have a timeout set, and that do not have a default timeout defined in their descriptor.- Specified by:
setQueryTimeoutDefault
in interfaceSession
-
setQueryTimeoutUnitDefault
public void setQueryTimeoutUnitDefault(TimeUnit queryTimeoutUnitDefault)
Description copied from interface:Session
PUBLIC: Set the default query timeout units for this session. This timeout unit will apply to any queries that do not have a unit value set, and that do not have a default timeout unit defined in their descriptor.- Specified by:
setQueryTimeoutUnitDefault
in interfaceSession
-
setProfiler
public void setProfiler(SessionProfiler profiler)
PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.- Specified by:
setProfiler
in interfaceSession
-
setProject
public void setProject(Project project)
INTERNAL: Set the project, the project holds configuration information including the descriptors.
-
setProperties
public void setProperties(Map<String,Object> propertiesMap)
INTERNAL: Set the user defined properties by shallow copying the propertiesMap.- Parameters:
propertiesMap
-
-
setProperty
public void setProperty(String propertyName, Object propertyValue)
PUBLIC: Allow for user defined properties.- Specified by:
setProperty
in interfaceSession
-
setQueries
public void setQueries(Map<String,List<DatabaseQuery>> queries)
INTERNAL: Set the named queries.
-
setSessionLog
public void setSessionLog(SessionLog sessionLog)
PUBLIC: Set the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, log level can not be OFF. Also set a backpointer to this session in SessionLog.- Specified by:
setSessionLog
in interfaceSession
- See Also:
logMessage(String)
-
setSynchronized
public void setSynchronized(boolean synched)
INTERNAL: Set isSynchronized flag to indicate that this session is synchronized. This method should only be called by setSynchronized methods of derived classes.
-
setTransactionMutex
protected void setTransactionMutex(ConcurrencyManager transactionMutex)
-
setWasJTSTransactionInternallyStarted
public void setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)
INTERNAL: Return if a JTS transaction was started by the session. The session will start a JTS transaction if a unit of work or transaction is begun without a JTS transaction present.
-
shouldLogMessages
public boolean shouldLogMessages()
PUBLIC: Return if logging is enabled (false if log level is OFF)- Specified by:
shouldLogMessages
in interfaceSession
-
startOperationProfile
public void startOperationProfile(String operationName)
INTERNAL: Start the operation timing.- Specified by:
startOperationProfile
in interfaceCommandProcessor
-
startOperationProfile
public void startOperationProfile(String operationName, DatabaseQuery query, int weight)
INTERNAL: Start the operation timing.
-
toString
public String toString()
Print the connection status with the session.
-
unwrapObject
public Object unwrapObject(Object proxy)
INTERNAL: Unwrap the object if required. This is used for the wrapper policy support and EJB.
-
updateObject
public Object updateObject(Object domainObject) throws DatabaseException, OptimisticLockException
PUBLIC: Update the object and all of its privately owned parts in the database. Update should only be used if the application knows that the object is new, otherwise writeObject should be used. The update operation can be customized through using an update query.- Throws:
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.- See Also:
UpdateObjectQuery
,writeObject(Object)
-
validateCache
public void validateCache()
ADVANCED: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.- Specified by:
validateCache
in interfaceSession
-
validateQuery
public void validateQuery(DatabaseQuery query)
INTERNAL: This method will be used to update the query with any settings required For this session. It can also be used to validate execution.
-
verifyDelete
public boolean verifyDelete(Object domainObject)
TESTING: This is used by testing code to ensure that a deletion was successful.
-
wasJTSTransactionInternallyStarted
public boolean wasJTSTransactionInternallyStarted()
INTERNAL: Return if a JTS transaction was started by the session. The session will start a JTS transaction if a unit of work or transaction is begun without a JTS transaction present.
-
wrapObject
public Object wrapObject(Object implementation)
INTERNAL: Wrap the object if required. This is used for the wrapper policy support and EJB.
-
writeAllObjectsWithChangeSet
protected void writeAllObjectsWithChangeSet(UnitOfWorkChangeSet uowChangeSet) throws DatabaseException, OptimisticLockException
INTERNAL: Write all of the objects and all of their privately owned parts in the database. The allows for a group of new objects to be commited as a unit. The objects will be commited through a single transactions and any foreign keys/circular references between the objects will be resolved.
-
writeObject
public Object writeObject(Object domainObject) throws DatabaseException, OptimisticLockException
PUBLIC: Write the object and all of its privately owned parts in the database. Write will determine if an insert or an update should be done, it may go to the database to determine this (by default will check the identity map). The write operation can be customized through using an write query.- Throws:
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.- See Also:
WriteObjectQuery
,insertObject(Object)
,updateObject(Object)
-
writesCompleted
public void writesCompleted()
INTERNAL: This method notifies the accessor that a particular sets of writes has completed. This notification can be used for such thing as flushing the batch mechanism
-
processCommand
public void processCommand(Object command)
INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Process the remote command from the RCM. The command may have come from any remote session or application. Since this is a EclipseLink session we can always assume that the object that we receive here will be a Command object.- Specified by:
processCommand
in interfaceCommandProcessor
- Parameters:
command
- Application formatted command to be processed
-
processJPAQueries
public void processJPAQueries()
INTERNAL: Process the JPA named queries into EclipseLink Session queries. This method is called after descriptor initialization. Temporarily made public for ODI. Should not be used elsewhere.
-
processJPAQuery
protected void processJPAQuery(DatabaseQuery jpaQuery)
INTERNAL: Process the JPA named query into an EclipseLink Session query. This method is called after descriptor initialization.
-
getCommandManager
public CommandManager getCommandManager()
PUBLIC: Return the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.- Specified by:
getCommandManager
in interfaceCommandProcessor
- Returns:
- The CommandManager instance that controls the remote command service for this session
- See Also:
CommandManager
-
setCommandManager
public void setCommandManager(CommandManager mgr)
ADVANCED: Set the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.- Specified by:
setCommandManager
in interfaceCommandProcessor
- Parameters:
mgr
- The CommandManager instance to control the remote command service for this session- See Also:
CommandManager
-
shouldPropagateChanges
public boolean shouldPropagateChanges()
PUBLIC: Return whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism. In order for this to occur the CommandManager must be set.- Returns:
- True if propagation is set to occur, false if not
- See Also:
setCommandManager(CommandManager)
-
setShouldPropagateChanges
public void setShouldPropagateChanges(boolean choice)
ADVANCED: Set whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism. In order for this to occur the CommandManager must be set.- Parameters:
choice
- If true (and the CommandManager is set) then propagation will occur- See Also:
setCommandManager(CommandManager)
-
shouldLogMessages
public boolean shouldLogMessages(int logLevel)
INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Return true if a message at the specified log level would be logged given the log level setting of this session. This can be used by the CommandManager to know whether it should even bother to create the localized strings and call the logMessage method, or if it would only find that the message would not be logged because the session level does not permit logging. The log level passed in will be one of the constants LOG_ERROR, LOG_WARNING, LOG_INFO, and LOG_DEBUG defined in the CommandProcessor interface.- Specified by:
shouldLogMessages
in interfaceCommandProcessor
- Parameters:
logLevel
- A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG- Returns:
- True if a message at the specified level should be logged and false if it should not
-
logMessage
public void logMessage(int logLevel, String message)
INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Log the specified message string at the specified level if it should be logged given the log level setting in this session. The log level passed in will be one of the constants LOG_ERROR, LOG_WARNING, LOG_INFO, and LOG_DEBUG defined in the CommandProcessor interface.- Specified by:
logMessage
in interfaceCommandProcessor
- Parameters:
logLevel
- A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUGmessage
- The message String that is to be logged
-
getLogLevel
public int getLogLevel(String category)
PUBLIC:Return the log level
- Specified by:
getLogLevel
in interfaceSession
- Parameters:
category
- the string representation of a EclipseLink category, e.g. "sql", "transaction" ...- Returns:
- the log level
- See Also:
SessionLog
-
getLogLevel
public int getLogLevel()
PUBLIC:Return the log level
- Specified by:
getLogLevel
in interfaceSession
- Returns:
- the log level
- See Also:
SessionLog
-
setLogLevel
public void setLogLevel(int level)
PUBLIC:Set the log level
- Specified by:
setLogLevel
in interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
- Specified by:
setLogLevel
in interfaceSession
- Parameters:
level
- the new log level- See Also:
SessionLog
-
shouldDisplayData
public boolean shouldDisplayData()
PUBLIC: Return true if SQL logging should log visible bind parameters. If the shouldDisplayData is not set, check the session log level and return true for a level greater than CONFIG.
-
shouldLog
public boolean shouldLog(int level, String category)
PUBLIC:Check if a message of the given level would actually be logged.
- Specified by:
shouldLog
in interfaceSession
- Parameters:
level
- the log request levelcategory
- the string representation of a EclipseLink category- Returns:
- true if the given message level will be logged
- See Also:
SessionLog
-
log
public void log(int level, String category, String message)
PUBLIC:Log a message with level and category that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messagecategory
- the string representation of a EclipseLink category.
-
log
public void log(int level, String category, String message, Object param)
PUBLIC:Log a message with level, category and a parameter that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messagecategory
- the string representation of a EclipseLink category.param
- a parameter of the message
-
log
public void log(int level, String category, String message, Object param1, Object param2)
PUBLIC:Log a message with level, category and two parameters that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messagecategory
- the string representation of a EclipseLink category.param1
- a parameter of the messageparam2
- second parameter of the message
-
log
public void log(int level, String category, String message, Object param1, Object param2, Object param3)
PUBLIC:Log a message with level, category and three parameters that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messagecategory
- the string representation of a EclipseLink category.param1
- a parameter of the messageparam2
- second parameter of the messageparam3
- third parameter of the message
-
log
public void log(int level, String category, String message, Object[] params)
PUBLIC:Log a message with level, category and an array of parameters that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messagecategory
- the string representation of a EclipseLink category.params
- array of parameters to the message
-
log
public void log(int level, String category, String message, Object[] params, Accessor accessor)
PUBLIC:Log a message with level, category, parameters and accessor that needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messageparams
- array of parameters to the messageaccessor
- the connection that generated the log entrycategory
- the string representation of a EclipseLink category.
-
log
public void log(int level, String category, String message, Object[] params, Accessor accessor, boolean shouldTranslate)
PUBLIC:Log a message with level, category, parameters and accessor. shouldTranslate determines if the message needs to be translated.
- Parameters:
level
- the log request level valuemessage
- the string messageparams
- array of parameters to the messageaccessor
- the connection that generated the log entrycategory
- the string representation of a EclipseLink category.shouldTranslate
- true if the message needs to be translated.
-
logThrowable
public void logThrowable(int level, String category, Throwable throwable)
PUBLIC:Log a throwable with level and category.
- Parameters:
level
- the log request level valuecategory
- the string representation of a EclipseLink category.throwable
- a Throwable
-
severe
public void severe(String message, String category)
PUBLIC:This method is called when a severe level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
warning
public void warning(String message, String category)
PUBLIC:This method is called when a warning level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
info
public void info(String message, String category)
PUBLIC:This method is called when a info level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
config
public void config(String message, String category)
PUBLIC:This method is called when a config level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
fine
public void fine(String message, String category)
PUBLIC:This method is called when a fine level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
finer
public void finer(String message, String category)
PUBLIC:This method is called when a finer level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
finest
public void finest(String message, String category)
PUBLIC:This method is called when a finest level message needs to be logged. The message will be translated
- Parameters:
message
- the message key
-
handleSevere
public Object handleSevere(RuntimeException exception) throws RuntimeException
PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.- Specified by:
handleSevere
in interfaceSession
- Throws:
RuntimeException
-
releaseReadConnection
public void releaseReadConnection(Accessor connection)
INTERNAL:
-
copyDescriptorsFromProject
public void copyDescriptorsFromProject()
INTERNAL: Copies descriptors cached on the Project. Used after Project.descriptors has been reset by addDescriptor(s) when the session is connected.
-
copyDescriptorNamedQueries
public void copyDescriptorNamedQueries(boolean allowSameQueryNameDiffArgsCopyToSession)
INTERNAL: This method will be used to copy all EclipseLink named queries defined in descriptors into the session.- Parameters:
allowSameQueryNameDiffArgsCopyToSession
- if the value is true, it allow multiple queries of the same name but different arguments to be copied to the session.
-
postAcquireConnection
public void postAcquireConnection(Accessor accessor)
INTERNAL: This method rises appropriate for the session event(s) right after connection is acquired.
-
preReleaseConnection
public void preReleaseConnection(Accessor accessor)
INTERNAL: This method rises appropriate for the session event(s) right before the connection is released.
-
priviledgedExecuteNonSelectingCall
public int priviledgedExecuteNonSelectingCall(Call call) throws DatabaseException
INTERNAL: Execute the call on the database. Calling this method will bypass a global setting to disallow native SQL queries. (set by default when one Entity is marked as multitenant) The row count is returned. The call can be a stored procedure call, SQL call or other type of call.Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee"), true);
- Throws:
DatabaseException
- See Also:
priviledgedExecuteSelectingCall(Call)
-
priviledgedExecuteSelectingCall
public Vector priviledgedExecuteSelectingCall(Call call) throws DatabaseException
INTERNAL: Execute the call on the database and return the result. Calling this method will bypass a global setting to disallow native SQL queries. (set by default when one Entity is marked as multitenant) The call must return a value, if no value is return executeNonSelectCall must be used. The call can be a stored procedure call, SQL call or other type of call. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
- Throws:
DatabaseException
- See Also:
priviledgedExecuteNonSelectingCall(Call)
-
isExclusiveConnectionRequired
public boolean isExclusiveConnectionRequired()
INTERNAL: This method is called in case externalConnectionPooling is used. If returns true, accessor used by the session keeps its connection open until released by the session.
-
getDefaultReferenceMode
public ReferenceMode getDefaultReferenceMode()
Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.- Specified by:
getDefaultReferenceMode
in interfaceSession
- See Also:
ReferenceMode
-
setDefaultReferenceMode
public void setDefaultReferenceMode(ReferenceMode defaultReferenceMode)
Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.- Specified by:
setDefaultReferenceMode
in interfaceSession
- See Also:
ReferenceMode
-
load
public void load(Object objectOrCollection, AttributeGroup group)
This method will load the passed object or collection of objects using the passed AttributeGroup. In case of collection all members should be either objects of the same mapped type or have a common inheritance hierarchy mapped root class. The AttributeGroup should correspond to the object type.- Parameters:
objectOrCollection
-
-
load
public void load(Object objectOrCollection, AttributeGroup group, ClassDescriptor referenceDescriptor, boolean fromFetchGroup)
This method will load the passed object or collection of objects using the passed AttributeGroup. In case of collection all members should be either objects of the same mapped type or have a common inheritance hierarchy mapped root class. The AttributeGroup should correspond to the object type.- Parameters:
objectOrCollection
-
-
retrieveCacheKey
public CacheKey retrieveCacheKey(Object primaryKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager, ObjectBuildingQuery query)
-
getPartitioningPolicy
public PartitioningPolicy getPartitioningPolicy()
PUBLIC: Return the session's partitioning policy.- Specified by:
getPartitioningPolicy
in interfaceSession
-
setPartitioningPolicy
public void setPartitioningPolicy(PartitioningPolicy partitioningPolicy)
PUBLIC: Set the session's partitioning policy. A PartitioningPolicy is used to partition, load-balance or replicate data across multiple difference databases or across a database cluster such as Oracle RAC. Partitioning can provide improved scalability by allowing multiple database machines to service requests.- Specified by:
setPartitioningPolicy
in interfaceSession
-
getRefreshMetadataListener
public MetadataRefreshListener getRefreshMetadataListener()
INTERNAL: This currently only used by JPA with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappers
-
setRefreshMetadataListener
public void setRefreshMetadataListener(MetadataRefreshListener metadatalistener)
-
isConcurrent
public boolean isConcurrent()
ADVANCED: Return if the session enables concurrent processing. Concurrent processing allow certain processing to be done on seperate threads. This can result in improved performance. This will use the session's server platform's thread pool.
-
setIsConcurrent
public void setIsConcurrent(boolean isConcurrent)
ADVANCED: Set if the session enables concurrent processing. Concurrent processing allow certain processing to be done on seperate threads. This can result in improved performance. This will use the session's server platform's thread pool.
-
setShouldOptimizeResultSetAccess
public void setShouldOptimizeResultSetAccess(boolean shouldOptimizeResultSetAccess)
ADVANCED: Set to indicate whether ObjectLevelReadQuery should by default use ResultSet Access optimization. If not set then parent's flag is used, is none set then ObjectLevelReadQuery.isResultSetAccessOptimizedQueryDefault is used. If the optimization specified by the session is ignored if incompatible with other query settings.
-
shouldOptimizeResultSetAccess
public boolean shouldOptimizeResultSetAccess()
ADVANCED: Indicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization. Optimization specified by the session is ignored if incompatible with other query settings.
-
setTolerateInvalidJPQL
public void setTolerateInvalidJPQL(boolean b)
ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time. Default is false.
-
shouldTolerateInvalidJPQL
public boolean shouldTolerateInvalidJPQL()
ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time. Default is false.
-
-