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,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>accessorsThe connection to the data store.protected ExposedNodeLinkedListactiveCommandThreadsList of active command threads.protected Map<String,AttributeGroup>attributeGroupsStores predefined reusable AttributeGroups.protected AbstractSessionbrokerSupport being owned by a session broker.protected CommandManagercommandManagerUsed to connect this session to EclipseLink cluster for distributed commandprotected CommitManagercommitManagerResolves referential integrity on commits.protected ReferenceModedefaultReferenceModeStores the default reference mode that a UnitOfWork will use when referencing managed objects.protected List<DescriptorEvent>deferredEventstemporarily holds a list of events that must be fired after the current operation completes.protected Map<Class<?>,ClassDescriptor>descriptorsPERF: cache descriptors from project.protected SessionEventManagereventManagerStores the event listeners for this session.protected ExceptionHandlerexceptionHandlerExceptionHandler handles database exceptions.protected ExternalTransactionControllerexternalTransactionControllerDelegate that handles synchronizing a UnitOfWork with an external transaction.protected IdentityMapAccessoridentityMapAccessorManages the live object cache.protected InjectionManager<?>injectionManagerAllow CDI injection of entity listenersprotected IntegrityCheckerintegrityCheckerIntegrityChecker catch all the descriptor Exceptions.protected booleanisConcurrentAllow a session to enable concurrent processing.protected booleanisExecutingEventsrecords that the UOW is executing deferred events.protected booleanisFinalizersEnabledPERF: Allow for finalizers to be enabled, currently enables client-session finalize.protected booleanisInBrokerUsed to determine If a session is in a Broker or notprotected booleanisInProfileUsed to determine If a session is in a profile or notprotected booleanisLoggingOffPERF: Quick check if logging is OFF entirely.protected booleanisSynchronizedIndicates whether the session is synchronized.protected booleanjpaQueriesProcessedStores predefined not yet parsed JPQL queries.protected ClassDescriptorlastDescriptorAccessedLast descriptor accessed, use to optimize descriptor lookup.protected StringlogSessionStringWhen logging the name of the session is typed: class name + system hashcode.protected MetadataRefreshListenermetadatalistenerthe MetadataRefreshListener is used with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappersprotected Set<String>multitenantContextPropertiesStores the set of multitenant context properties this session requiresprotected StringnameUsed to identify a session when using the session broker.protected intnumberOfActiveUnitsOfWorkKeep track of active units of work.protected MapobjectsLockedForCloneThis collection will be used to store those objects that are currently locked for the clone process.protected PartitioningPolicypartitioningPolicyAllow queries to be targeted at specific connection pools.protected IntegerpessimisticLockTimeoutDefaultDefault pessimistic lock timeout value.protected TimeUnitpessimisticLockTimeoutUnitDefaultprotected PlatformplatformAllow the datasource platform to be cached.protected SessionProfilerprofilerTool that log performance information.protected ProjectprojectThe project stores configuration information, such as the descriptors and login.protected Map<String,Object>propertiesAllow for user defined properties.protected Map<String,List<DatabaseQuery>>queriesStores predefine reusable queries.protected JPAQueryBuilderqueryBuilderStore the query builder used to parse JPQL.protected intqueryTimeoutDefaultprotected TimeUnitqueryTimeoutUnitDefaultprotected SerializerserializerSet the Serializer to use by default for serialization.protected SessionLogsessionLogDestination for logged messages and SQL.protected booleanshouldCheckWriteLockPERF: Cache the write-lock check to avoid cost of checking in every register/clone.protected booleanshouldOptimizeResultSetAccessIndicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization.protected booleanshouldPropagateChangesDetermined whether changes should be propagated to an EclipseLink clusterprotected Map<String,String>staticMetamodelClassesThis map will hold onto class to static metamodel class references from JPA.protected List<ClassDescriptor>tablePerTenantDescriptorsPERF: cache table per tenant descriptors needing to be initialized per EMprotected List<DatabaseQuery>tablePerTenantQueriesPERF: cache table per tenant queries needing to be initialized per EMprotected booleantolerateInvalidJPQLIndicates whether Session creation should tolerate an invalid NamedQuery.protected ConcurrencyManagertransactionMutexEnsure mutual exclusion of the session's transaction state across multiple threads.protected booleanwasJTSTransactionInternallyStartedIf 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 protectedAbstractSession()INTERNAL: Create and return a new session.protectedAbstractSession(int nothing)INTERNAL: Create a blank session, used for proxy session.protectedAbstractSession(Login login)PUBLIC: Create and return a new session.protectedAbstractSession(Project project)PUBLIC: Create and return a new session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessionacquireHistoricalSession(AsOfClause clause)INTERNAL: Constructs a HistoricalSession given a valid AsOfClause.UnitOfWorkImplacquireNonSynchronizedUnitOfWork()INTERNAL: Return a unit of work for this session not registered with the JTS transaction.UnitOfWorkImplacquireNonSynchronizedUnitOfWork(ReferenceMode referenceMode)INTERNAL: Return a unit of work for this session not registered with the JTS transaction.RepeatableWriteUnitOfWorkacquireRepeatableWriteUnitOfWork(ReferenceMode referenceMode)PUBLIC: Return a repeatable write unit of work for this session.UnitOfWorkImplacquireUnitOfWork()PUBLIC: Return a unit of work for this session.UnitOfWorkImplacquireUnitOfWork(ReferenceMode referenceMode)PUBLIC: Return a unit of work for this session.voidaddAlias(String alias, ClassDescriptor descriptor)PUBLIC: Add an alias for the descriptorvoidaddJPAQuery(DatabaseQuery query)INTERNAL: Return all pre-defined not yet parsed EJBQL queries.voidaddJPATablePerTenantQuery(DatabaseQuery query)INTERNAL: Return all pre-defined not yet parsed EJBQL multitenant queries.voidaddMultitenantContextProperty(String contextProperty)PUBLIC: Return a set of multitenant context properties this sessionvoidaddQuery(String name, DatabaseQuery query)PUBLIC: Add the query to the session queries with the given name.voidaddQuery(String name, DatabaseQuery query, boolean replace)PUBLIC: Add the query to the session queries with the given name.protected voidaddQuery(DatabaseQuery query, boolean nameMustBeUnique)INTERNAL: Add the query to the session queries.voidaddStaticMetamodelClass(String modelClassName, String metamodelClassName)INTERNAL: Add a metamodel class to model class reference.protected voidaddTablePerTenantDescriptor(ClassDescriptor descriptor)INTERNAL: Add a descriptor that is uses a table per tenant multitenant policy.protected voidaddTablePerTenantQuery(DatabaseQuery query)INTERNAL: Add a query that queries a table per tenant entityprotected voidbasicBeginTransaction()INTERNAL: Called by beginTransaction() to start a transaction.protected voidbasicBeginTransaction(Accessor accessor)INTERNAL: Called by beginTransaction() to start a transaction.protected voidbasicCommitTransaction()INTERNAL: Called by commitTransaction() to commit a transaction.ObjectbasicExecuteCall(Call call, AbstractRecord translationRow, DatabaseQuery query)INTERNAL: Execute the call on each accessors and merge the results.protected voidbasicRollbackTransaction()INTERNAL: Called by rollbackTransaction() to rollback a transaction.booleanbeginExternalTransaction()INTERNAL: Attempts to begin an external transaction.voidbeginTransaction()PUBLIC: Begin a transaction on the database.protected JPAQueryBuilderbuildDefaultQueryBuilder()INTERNAL Build the JPQL builder based on session properties.voidcheckAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor)INTERNAL: Check if the object is invalid and refresh it.protected ClassDescriptorcheckHierarchyForDescriptor(Class<?> theClass)Check to see if the descriptor of a superclass can be used to describe this classvoidcleanUpInjectionManager()allow the entity listener injection manager to clean itself up.voidclearDescriptors()INTERNAL: Clear the the descriptors cache.voidclearIntegrityChecker()PUBLIC: clear the integrityChecker.voidclearLastDescriptorAccessed()INTERNAL: Clear the the lastDescriptorAccessed cache.voidclearProfile()PUBLIC: Clear the profiler, this will end the current profile operation.Objectclone()INTERNAL: Clones the descriptorbooleancommitExternalTransaction()INTERNAL: Attempts to commit the running internally started external transaction.voidcommitTransaction()PUBLIC: Commit the active database transaction.booleancompareObjects(Object firstObject, Object secondObject)INTERNAL: Return if the two object match completely.booleancompareObjectsDontMatch(Object firstObject, Object secondObject)TESTING: Return true if the object do not match.voidconfig(String message, String category)PUBLIC:booleancontainsQuery(String queryName)PUBLIC: Return true if the pre-defined query is defined on the session.Objectcopy(Object originalObjectOrObjects)PUBLIC: Return a complete copy of the object or of collection of objects.Objectcopy(Object originalObjectOrObjects, AttributeGroup group)PUBLIC: Return a complete copy of the object or of collection of objects.voidcopyDescriptorNamedQueries(boolean allowSameQueryNameDiffArgsCopyToSession)INTERNAL: This method will be used to copy all EclipseLink named queries defined in descriptors into the session.voidcopyDescriptorsFromProject()INTERNAL: Copies descriptors cached on the Project.ObjectcopyInternal(Object originalObject, CopyGroup copyGroup)INTERNAL:VectorcopyReadOnlyClasses()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<T> DatabaseValueHolder<T>createCloneQueryValueHolder(ValueHolderInterface<T> attributeValue, Object clone, AbstractRecord row, ForeignReferenceMapping mapping)<T> DatabaseValueHolder<T>createCloneTransformationValueHolder(ValueHolderInterface<T> attributeValue, Object original, Object clone, AbstractTransformationMapping mapping)<T> InjectionManager<T>createInjectionManager(Object beanManager)ObjectcreateProtectedInstanceFromCachedData(Object cached, Integer refreshCascade, ClassDescriptor descriptor)INTERNAL: This method is similar to getAndCloneCacheKeyFromParent.voiddeferEvent(DescriptorEvent event)INTERNAL: Add an event to the deferred list.voiddeleteAllObjects(Collection domainObjects)PUBLIC: delete all of the objects and all of their privately owned parts in the database.ObjectdeleteObject(Object domainObject)PUBLIC: Delete the object and all of its privately owned parts from the database.booleandoesObjectExist(Object object)PUBLIC: Return if the object exists on the database or not.voiddontLogMessages()PUBLIC: Turn off loggingvoidendOperationProfile(String operationName)INTERNAL: End the operation timing.voidendOperationProfile(String operationName, DatabaseQuery query, int weight)INTERNAL: End the operation timing.ObjectexecuteCall(Call call, AbstractRecord translationRow, DatabaseQuery query)INTERNAL: Overridden by subclasses that do more than just execute the call.voidexecuteDeferredEvents()INTERNAL: Causes any deferred events to be fired.intexecuteNonSelectingCall(Call call)PUBLIC: Execute the call on the database.voidexecuteNonSelectingSQL(String sqlString)PUBLIC: Execute the sql on the database.ObjectexecuteQuery(String queryName)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass, Object arg1)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2, Object arg3)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass, List argumentValues)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Class<?> domainClass, Vector argumentValues)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Object arg1)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Object arg1, Object arg2)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Object arg1, Object arg2, Object arg3)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, List argumentValues)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(String queryName, Vector argumentValues)PUBLIC: Execute the pre-defined query by name and return the result.ObjectexecuteQuery(DatabaseQuery query)PUBLIC: Execute the database query.ObjectexecuteQuery(DatabaseQuery query, List argumentValues)PUBLIC: Return the results from executing the database query.ObjectexecuteQuery(DatabaseQuery query, AbstractRecord row)INTERNAL: Return the results from executing the database query.ObjectexecuteQuery(DatabaseQuery query, AbstractRecord row, int retryCount)INTERNAL: Return the results from executing the database query.VectorexecuteSelectingCall(Call call)PUBLIC: Execute the call on the database and return the result.VectorexecuteSQL(String sqlString)PUBLIC: Execute the sql on the database and return the result.voidfine(String message, String category)PUBLIC:voidfiner(String message, String category)PUBLIC:voidfinest(String message, String category)PUBLIC:AccessorgetAccessor()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.ExposedNodeLinkedListgetActiveCommandThreads()INTERNAL:SessiongetActiveSession()PUBLIC: Return the active session for the current active external (JTS) transaction.UnitOfWorkgetActiveUnitOfWork()PUBLIC: Return the active unit of work for the current active external (JTS) transaction.MapgetAliasDescriptors()INTERNAL: Returns the alias descriptors Map.List<DatabaseQuery>getAllQueries()INTERNAL: Return the pre-defined queries in this session.AsOfClausegetAsOfClause()ADVANCED: Answers the past time this session is as of.Map<String,AttributeGroup>getAttributeGroups()ADVANCED Return all predefined attribute groupsAbstractSessiongetBroker()INTERNAL: Allow the session to be used from a session broker.protected CacheKeygetCacheKeyFromTargetSessionForMerge(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.ClassDescriptorgetClassDescriptor(Class<?> theClass)ADVANCED: Return the descriptor specified for the class.ClassDescriptorgetClassDescriptor(Object domainObject)ADVANCED: Return the descriptor specified for the object's class.ClassDescriptorgetClassDescriptorForAlias(String alias)PUBLIC: Return the descriptor for the alias.CommandManagergetCommandManager()PUBLIC: Return the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.CommitManagergetCommitManager()INTERNAL: The commit manager is used to resolve referential integrity on commits of multiple objects.LogingetDatasourceLogin()PUBLIC: Return the login, the login holds any database connection information given.PlatformgetDatasourcePlatform()INTERNAL: Return the database platform currently connected to.VectorgetDefaultReadOnlyClasses()INTERNAL: Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.ReferenceModegetDefaultReferenceMode()Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.ClassDescriptorgetDescriptor(Class<?> theClass)ADVANCED: Return the descriptor specified for the class.ClassDescriptorgetDescriptor(Object domainObject)ADVANCED: Return the descriptor specified for the object's class.ClassDescriptorgetDescriptorForAlias(String alias)PUBLIC: Return the descriptor for the alias.Map<Class<?>,ClassDescriptor>getDescriptors()ADVANCED: Return all registered descriptors.SessionEventManagergetEventManager()PUBLIC: Return the event manager.ExceptionHandlergetExceptionHandler()PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.StringgetExceptionHandlerClass()INTERNAL: Return a string which represents my ExceptionHandler's class Added for F2104: Properties.xml - gnAbstractSessiongetExecutionSession(DatabaseQuery query)INTERNAL: Gets the session which this query will be executed on.ExternalTransactionControllergetExternalTransactionController()PUBLIC: Used for JTS integration.ObjectgetId(Object domainObject)ADVANCED: Extract and return the primary key from the object.IdentityMapAccessorgetIdentityMapAccessor()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.IdentityMapAccessorgetIdentityMapAccessorInstance()INTERNAL: Return the internally available IdentityMapAccessor instance.<T> InjectionManager<T>getInjectionManager()IntegrityCheckergetIntegrityChecker()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.ClassLoadergetLoader()INTERNAL: Return the class loader for the session's application.WritergetLog()PUBLIC: Return the writer to which an accessor writes logged messages and SQL.DatabaseLogingetLogin()OBSOLETE: Return the login, the login holds any database connection information given.intgetLogLevel()PUBLIC:intgetLogLevel(String category)PUBLIC:StringgetLogSessionString()INTERNAL: Return the name of the session: class name + system hashcode.ClassDescriptorgetMappedSuperclass(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 sessionStringgetName()PUBLIC: Return the name of the session.longgetNextQueryId()INTERNAL: Called by a sessions queries to obtain individual query ids.NumbergetNextSequenceNumberValue(Class<?> domainClass)ADVANCED: Return the sequnce number from the databaseintgetNumberOfActiveUnitsOfWork()INTERNAL: Return the number of units of work connected.AbstractSessiongetParent()INTERNAL: Gets the parent session.AbstractSessiongetParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)INTERNAL: Returns the appropriate IdentityMap session for this descriptor.AbstractSessiongetParentIdentityMapSession(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.AbstractSessiongetParentIdentityMapSession(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.PartitioningPolicygetPartitioningPolicy()PUBLIC: Return the session's partitioning policy.IntegergetPessimisticLockTimeoutDefault()INTERNAL: Returns the default pessimistic lock timeout value.TimeUnitgetPessimisticLockTimeoutUnitDefault()DatabasePlatformgetPlatform()INTERNAL: Return the database platform currently connected to.PlatformgetPlatform(Class<?> domainClass)INTERNAL: Return the database platform currently connected to for specified class.SessionProfilergetProfiler()PUBLIC: Return the profiler.ProjectgetProject()PUBLIC: Return the project, the project holds configuartion information including the descriptors.Map<String,Object>getProperties()ADVANCED: Allow for user defined properties.ObjectgetProperty(String name)ADVANCED: Returns the user defined property.Map<String,List<DatabaseQuery>>getQueries()ADVANCED: Return all pre-defined queries.DatabaseQuerygetQuery(String name)PUBLIC: Return the query from the session pre-defined queries with the given name.DatabaseQuerygetQuery(String name, List arguments)PUBLIC: Return the query from the session pre-defined queries with the given name and argument types.DatabaseQuerygetQuery(String name, Vector arguments)PUBLIC: Return the query from the session pre-defined queries with the given name and argument types.DatabaseQuerygetQuery(String name, Vector arguments, boolean shouldSearchParent)INTERNAL: Return the query from the session pre-defined queries with the given name and argument types.JPAQueryBuildergetQueryBuilder()INTERNAL Return the query builder used to parser JPQL.intgetQueryTimeoutDefault()PUBLIC: Return the default query timeout for this session.TimeUnitgetQueryTimeoutUnitDefault()MetadataRefreshListenergetRefreshMetadataListener()INTERNAL: This currently only used by JPA with RCM to force a refresh of the metadata used within EntityManagerFactoryWrappersAbstractSessiongetRootSession(DatabaseQuery query)INTERNAL: The session that this query is executed against when not in transaction.SequencinggetSequencing()INTERNAL: Return the Sequencing object used by the session.SerializergetSerializer()Return the Serializer to use by default for serialization.ServerPlatformgetServerPlatform()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)AbstractSessiongetSessionForClass(Class<?> domainClass)INTERNAL: Return the session to be used for the class.AbstractSessiongetSessionForName(String name)INTERNAL: Return the session by name.SessionLoggetSessionLog()PUBLIC: Return the session log to which an accessor logs messages and SQL.StringgetSessionTypeString()INTERNAL: Returns the type of session, its class.StringgetStaticMetamodelClass(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.ConcurrencyManagergetTransactionMutex()INTERNAL: The transaction mutex ensure mutual exclusion on transaction across multiple threads.ObjecthandleException(RuntimeException exception)PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.ObjecthandleSevere(RuntimeException exception)PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.booleanhasBroker()INTERNAL: Allow the session to be used from a session broker.booleanhasCommitManager()INTERNAL: Return if the commit manager has been set.booleanhasDescriptor(Class<?> theClass)ADVANCED: Return true if a descriptor exists for the given class.booleanhasEventManager()INTERNAL: Return if an event manager has been set.booleanhasExceptionHandler()PUBLIC: Return if an exception handler is present.booleanhasExternalTransactionController()PUBLIC: Used for JTA integration.booleanhasProperties()INTERNAL: Allow to check for user defined properties.booleanhasTablePerTenantDescriptors()INTERNAL: Return list of table per tenant multitenant descriptors.booleanhasTablePerTenantQueries()INTERNAL: Return a list of table per tenant multitenant queries.voidincrementProfile(String operationName)INTERNAL: Updates the count of SessionProfiler eventvoidincrementProfile(String operationName, DatabaseQuery query)INTERNAL: Updates the count of SessionProfiler eventvoidinfo(String message, String category)PUBLIC:voidinitializeIdentityMapAccessor()INTERNAL: Set up the IdentityMapManager.ObjectinsertObject(Object domainObject)PUBLIC: Insert the object and all of its privately owned parts into the database.ObjectinternalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow)INTERNAL: Return the results from exeucting the database query.booleanisBroker()INTERNAL: Returns true if the session is a session Broker.booleanisClassReadOnly(Class<?> theClass)PUBLIC: Return if the class is defined as read-only.booleanisClassReadOnly(Class<?> theClass, ClassDescriptor descriptor)INTERNAL: Return if the class is defined as read-only.booleanisClientSession()PUBLIC: Return if this session is a client session.booleanisConcurrent()ADVANCED: Return if the session enables concurrent processing.booleanisConnected()PUBLIC: Return if this session is connected to the database.booleanisConsideredInvalid(Object object, CacheKey cacheKey, ClassDescriptor descriptor)INTERNAL: Check if the object is invalid and *should* be refreshed.booleanisDatabaseSession()PUBLIC: Return if this session is a database session.booleanisDistributedSession()PUBLIC: Return if this session is a distributed session.booleanisExclusiveConnectionRequired()INTERNAL: This method is called in case externalConnectionPooling is used.booleanisExclusiveIsolatedClientSession()PUBLIC: Return if this session is an exclusive isolated client session.booleanisFinalizersEnabled()PUBLIC: Return if this session's decendants should use finalizers.booleanisHistoricalSession()INTERNAL: Return if this session is a historical session.booleanisInBroker()INTERNAL: Returns true if the session is in a session Broker.booleanisInProfile()PUBLIC: Return if a profiler is being used.booleanisInTransaction()PUBLIC: Return if the session is currently in the progress of a database transaction.booleanisIsolatedClientSession()PUBLIC: Return if this session is an isolated client session.booleanisJPAQueriesProcessed()INTERNAL: used to see if JPA Queries have been processed during initializationbooleanisLoggingOff()INTERNAL: PERF: Used for quick check if logging is OFF entirely.booleanisProtectedSession()PUBLIC: Returns true if Protected Entities should be built within this sessionbooleanisRemoteSession()PUBLIC: Return if this session is remote.booleanisRemoteUnitOfWork()PUBLIC: Return if this session is a unit of work.booleanisServerSession()PUBLIC: Return if this session is a server session.booleanisSessionBroker()PUBLIC: Return if this session is a session broker.booleanisSynchronized()INTERNAL: Return if this session is synchronized.booleanisUnitOfWork()PUBLIC: Return if this session is a unit of work.ObjectkeyFromObject(Object domainObject, ClassDescriptor descriptor)ADVANCED: Extract and return the primary key from the object.voidload(Object objectOrCollection, AttributeGroup group)This method will load the passed object or collection of objects using the passed AttributeGroup.voidload(Object objectOrCollection, AttributeGroup group, ClassDescriptor referenceDescriptor, boolean fromFetchGroup)This method will load the passed object or collection of objects using the passed AttributeGroup.voidlog(int level, String category, String message)PUBLIC:voidlog(int level, String category, String message, Object param)PUBLIC:voidlog(int level, String category, String message, Object[] params)PUBLIC:voidlog(int level, String category, String message, Object[] params, Accessor accessor)PUBLIC:voidlog(int level, String category, String message, Object[] params, Accessor accessor, boolean shouldTranslate)PUBLIC:voidlog(int level, String category, String message, Object param1, Object param2)PUBLIC:voidlog(int level, String category, String message, Object param1, Object param2, Object param3)PUBLIC:voidlog(SessionLogEntry entry)PUBLIC: Log the log entry.voidlogMessage(int logLevel, String message)INTERNAL: RemoteCommandManager method.voidlogMessage(String message)Log a untranslated message to the EclipseLink log at FINER level.voidlogThrowable(int level, String category, Throwable throwable)PUBLIC:voidpostAcquireConnection(Accessor accessor)INTERNAL: This method rises appropriate for the session event(s) right after connection is acquired.DatabaseQueryprepareDatabaseQuery(DatabaseQuery query)INTERNAL: A call back to do session specific preparation of a query.voidpreReleaseConnection(Accessor accessor)INTERNAL: This method rises appropriate for the session event(s) right before the connection is released.intpriviledgedExecuteNonSelectingCall(Call call)INTERNAL: Execute the call on the database.VectorpriviledgedExecuteSelectingCall(Call call)INTERNAL: Execute the call on the database and return the result.voidprocessCommand(Object command)INTERNAL: RemoteCommandManager method.voidprocessJPAQueries()INTERNAL: Process the JPA named queries into EclipseLink Session queries.protected voidprocessJPAQuery(DatabaseQuery jpaQuery)INTERNAL: Process the JPA named query into an EclipseLink Session query.VectorreadAllObjects(Class<?> domainClass)PUBLIC: Read all of the instances of the class from the database.VectorreadAllObjects(Class<?> domainClass, String sqlString)PUBLIC: Read all of the instances of the class from the database return through execution the SQL string.VectorreadAllObjects(Class<?> domainClass, Expression expression)PUBLIC: Read all of the instances of the class from the database matching the given expression.VectorreadAllObjects(Class<?> referenceClass, Call aCall)PUBLIC: Read all the instances of the class from the database returned through execution the Call string.ObjectreadObject(Class<?> domainClass)PUBLIC: Read the first instance of the class from the database.ObjectreadObject(Class<?> domainClass, String sqlString)PUBLIC: Read the first instance of the class from the database return through execution the SQL string.ObjectreadObject(Class<?> domainClass, Expression expression)PUBLIC: Read the first instance of the class from the database matching the given expression.ObjectreadObject(Class<?> domainClass, Call aCall)PUBLIC: Read the first instance of the class from the database returned through execution the Call string.ObjectreadObject(Object object)PUBLIC: Use the example object to consruct a read object query by the objects primary key.ObjectrefreshAndLockObject(Object object)PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.ObjectrefreshAndLockObject(Object object, short lockMode)PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.ObjectrefreshObject(Object object)PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.voidregisterFinalizer()INTERNAL: Register a finalizer to release this session.voidrelease()PUBLIC: Release the session.voidreleaseConnectionAfterCall(DatabaseQuery query)INTERNAL: Release (if required) connection after call.voidreleaseJTSConnection()INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener.voidreleaseReadConnection(Accessor connection)INTERNAL:voidreleaseUnitOfWork(UnitOfWorkImpl unitOfWork)INTERNAL: Release the unit of work, if lazy release the connection.voidremoveProperty(String property)PUBLIC: Remove the user defined property.voidremoveQuery(String queryName)PUBLIC: Remove all queries with the given queryName regardless of the argument types.voidremoveQuery(String queryName, Vector argumentTypes)PUBLIC: Remove the specific query with the given queryName and argumentTypes.CacheKeyretrieveCacheKey(Object primaryKey, ClassDescriptor concreteDescriptor, JoinedAttributeManager joinManager, ObjectBuildingQuery query)ObjectretryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)INTERNAL: A query execution failed due to an invalid query.DatabaseExceptionretryTransaction(Accessor accessor, DatabaseException databaseException, int retryCount, AbstractSession executionSession)INTERNAL: A begin transaction failed.protected booleanrollbackExternalTransaction()PROTECTED: Attempts to rollback the running internally started external transaction.voidrollbackTransaction()PUBLIC: Rollback the active database transaction.voidsetAccessor(Accessor accessor)INTERNAL: Set the accessor.voidsetBroker(AbstractSession broker)INTERNAL: Allow the session to be used from a session broker.voidsetCommandManager(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.voidsetCommitManager(CommitManager commitManager)INTERNAL: The commit manager is used to resolve referncial integrity on commits of multiple objects.voidsetDatasourceLogin(Login login)PUBLIC: Set the login.voidsetDefaultReferenceMode(ReferenceMode defaultReferenceMode)Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.voidsetEventManager(SessionEventManager eventManager)INTERNAL: Set the event manager.voidsetExceptionHandler(ExceptionHandler exceptionHandler)PUBLIC: Set the exceptionHandler.voidsetExternalTransactionController(ExternalTransactionController externalTransactionController)Used for JTS integration internally by ServerPlatform.voidsetInjectionManager(InjectionManager<?> injectionManager)voidsetIntegrityChecker(IntegrityChecker integrityChecker)PUBLIC: set the integrityChecker.voidsetIsConcurrent(boolean isConcurrent)ADVANCED: Set if the session enables concurrent processing.voidsetIsFinalizersEnabled(boolean isFinalizersEnabled)PUBLIC: Set if this session's decendants should use finalizers.voidsetIsInBroker(boolean isInBroker)INTERNAL: Set if this session is contained in a SessionBroker.voidsetIsInProfile(boolean inProfile)PUBLIC: Allow for user deactive a profilervoidsetJPAQueriesProcessed(boolean jpaQueriesProcessed)INTERNAL: used to set if JPA Queries have been processed during initializationvoidsetLog(Writer log)PUBLIC: Set the writer to which an accessor writes logged messages and SQL.voidsetLoggingOff(boolean loggingOff)INTERNAL: PERF: Used for quick turning logging ON/OFF entirely.voidsetLogin(DatabaseLogin login)PUBLIC: Set the login.voidsetLogin(Login login)PUBLIC: Set the login.voidsetLogLevel(int level)PUBLIC:voidsetName(String name)PUBLIC: Set the name of the session.protected voidsetNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)voidsetPartitioningPolicy(PartitioningPolicy partitioningPolicy)PUBLIC: Set the session's partitioning policy.voidsetPessimisticLockTimeoutDefault(Integer pessimisticLockTimeoutDefault)PUBLIC: Set the default pessimistic lock timeout value.voidsetPessimisticLockTimeoutUnitDefault(TimeUnit pessimisticLockTimeoutUnitDefault)voidsetProfiler(SessionProfiler profiler)PUBLIC: Set the profiler for the session.voidsetProject(Project project)INTERNAL: Set the project, the project holds configuration information including the descriptors.voidsetProperties(Map<String,Object> propertiesMap)INTERNAL: Set the user defined properties by shallow copying the propertiesMap.voidsetProperty(String propertyName, Object propertyValue)PUBLIC: Allow for user defined properties.voidsetQueries(Map<String,List<DatabaseQuery>> queries)INTERNAL: Set the named queries.voidsetQueryBuilder(JPAQueryBuilder queryBuilder)INTERNAL Set the query builder used to parser JPQL.voidsetQueryTimeoutDefault(int queryTimeoutDefault)PUBLIC: Set the default query timeout for this session.voidsetQueryTimeoutUnitDefault(TimeUnit queryTimeoutUnitDefault)PUBLIC: Set the default query timeout units for this session.voidsetRefreshMetadataListener(MetadataRefreshListener metadatalistener)voidsetSerializer(Serializer serializer)Set the Serializer to use by default for serialization.voidsetSessionLog(SessionLog sessionLog)PUBLIC: Set the session log to which an accessor logs messages and SQL.voidsetShouldOptimizeResultSetAccess(boolean shouldOptimizeResultSetAccess)ADVANCED: Set to indicate whether ObjectLevelReadQuery should by default use ResultSet Access optimization.voidsetShouldPropagateChanges(boolean choice)ADVANCED: Set whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism.voidsetSynchronized(boolean synched)INTERNAL: Set isSynchronized flag to indicate that this session is synchronized.voidsetTolerateInvalidJPQL(boolean b)ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time.protected voidsetTransactionMutex(ConcurrencyManager transactionMutex)voidsetWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)INTERNAL: Return if a JTS transaction was started by the session.voidsevere(String message, String category)PUBLIC:booleanshouldDisplayData()PUBLIC: Return true if SQL logging should log visible bind parameters.booleanshouldLog(int level, String category)PUBLIC:booleanshouldLogMessages()PUBLIC: Return if logging is enabled (false if log level is OFF)booleanshouldLogMessages(int logLevel)INTERNAL: RemoteCommandManager method.booleanshouldOptimizeResultSetAccess()ADVANCED: Indicates whether ObjectLevelReadQuery should by default use ResultSet Access optimization.booleanshouldPropagateChanges()PUBLIC: Return whether changes should be propagated to other sessions or applications in a EclipseLink cluster through the Remote Command Manager mechanism.booleanshouldTolerateInvalidJPQL()ADVANCED: Indicates whether an invalid NamedQuery will be tolerated at init time.voidstartOperationProfile(String operationName)INTERNAL: Start the operation timing.voidstartOperationProfile(String operationName, DatabaseQuery query, int weight)INTERNAL: Start the operation timing.StringtoString()Print the connection status with the session.ObjectunwrapObject(Object proxy)INTERNAL: Unwrap the object if required.ObjectupdateObject(Object domainObject)PUBLIC: Update the object and all of its privately owned parts in the database.voidupdateProfile(String operationName, Object value)INTERNAL: Updates the value of SessionProfiler statevoidupdateTablePerTenantDescriptors(String property, Object value)INTERNAL: Set the table per tenant.voidvalidateCache()ADVANCED: This can be used to help debugging an object identity problem.voidvalidateQuery(DatabaseQuery query)INTERNAL: This method will be used to update the query with any settings required For this session.booleanverifyDelete(Object domainObject)TESTING: This is used by testing code to ensure that a deletion was successful.voidwarning(String message, String category)PUBLIC:booleanwasJTSTransactionInternallyStarted()INTERNAL: Return if a JTS transaction was started by the session.ObjectwrapObject(Object implementation)INTERNAL: Wrap the object if required.protected voidwriteAllObjectsWithChangeSet(UnitOfWorkChangeSet uowChangeSet)INTERNAL: Write all of the objects and all of their privately owned parts in the database.ObjectwriteObject(Object domainObject)PUBLIC: Write the object and all of its privately owned parts in the database.voidwritesCompleted()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
protected 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
protected 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:
getSerializerin interfaceSession
-
setSerializer
public void setSerializer(Serializer serializer)
Set the Serializer to use by default for serialization.- Specified by:
setSerializerin 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 whentrueand 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:
acquireHistoricalSessionin interfaceSession- Parameters:
clause- Represents a valid snap shot time.- Throws:
ValidationException- ifthisnot 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:
acquireUnitOfWorkin 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:
acquireUnitOfWorkin 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:
addJPAQueryin 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 DatabaseExceptionINTERNAL: 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 DatabaseExceptionINTERNAL: Called by commitTransaction() to commit a transaction. This commits the active transaction.- Throws:
DatabaseException
-
basicRollbackTransaction
protected void basicRollbackTransaction() throws DatabaseExceptionINTERNAL: 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, ConcurrencyExceptionPUBLIC: 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- 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:
clearIntegrityCheckerin 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:
clearProfilein 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, ConcurrencyExceptionPUBLIC: 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:
containsQueryin 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:
copyin 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 <T> DatabaseValueHolder<T> createCloneQueryValueHolder(ValueHolderInterface<T> attributeValue, Object clone, AbstractRecord row, ForeignReferenceMapping mapping)
-
createCloneTransformationValueHolder
public <T> DatabaseValueHolder<T> createCloneTransformationValueHolder(ValueHolderInterface<T> 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:
doesObjectExistin interfaceSession- Throws:
DatabaseException
-
dontLogMessages
public void dontLogMessages()
PUBLIC: Turn off logging- Specified by:
dontLogMessagesin interfaceSession
-
endOperationProfile
public void endOperationProfile(String operationName)
INTERNAL: End the operation timing.- Specified by:
endOperationProfilein 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:
updateProfilein 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:
incrementProfilein 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.
-
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:
executeNonSelectingCallin 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:
executeNonSelectingSQLin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeQueryin 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:
executeSelectingCallin 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:
executeSQLin 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:
getActiveSessionin 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:
getActiveUnitOfWorkin 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:
getAsOfClausein interfaceSession- Returns:
- An immutable object representation of the past time.
nullif 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 atthisis 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 atthisis 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:
getClassDescriptorin 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:
getClassDescriptorin interfaceSession
-
getClassDescriptorForAlias
public ClassDescriptor getClassDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias. UnitOfWork delegates this to the parent- Specified by:
getClassDescriptorForAliasin 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:
getDescriptorin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getDescriptorin 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:
getDescriptorin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getDescriptorin interfaceSession
-
getDescriptorForAlias
public ClassDescriptor getDescriptorForAlias(String alias)
PUBLIC: Return the descriptor for the alias.- Specified by:
getDescriptorForAliasin interfaceSession- Parameters:
alias- The descriptor alias.- Returns:
- The descriptor for the alias or
nullif no descriptor was found.
-
getDescriptors
public Map<Class<?>,ClassDescriptor> getDescriptors()
ADVANCED: Return all registered descriptors.- Specified by:
getDescriptorsin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getDescriptorsin interfaceSession- Specified by:
getDescriptorsin 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:
getEventManagerin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getEventManagerin 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:
getExceptionHandlerin 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:
getExternalTransactionControllerin 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:
getIdentityMapAccessorin 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:
getIntegrityCheckerin interfaceSession
-
getJPAQueries
public List<DatabaseQuery> getJPAQueries()
ADVANCED: Return all pre-defined not yet parsed JPQL queries.- Specified by:
getJPAQueriesin 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:
getLogin 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:
getDatasourceLoginin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getDatasourceLoginin 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:
getNextSequenceNumberValuein 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:
getPlatformin 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:
getDatasourcePlatformin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getDatasourcePlatformin interfaceSession- Specified by:
getDatasourcePlatformin 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:
getServerPlatformin 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:
getPlatformin 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:
getProfilerin interfaceSession
-
getProject
public Project getProject()
PUBLIC: Return the project, the project holds configuartion information including the descriptors.- Specified by:
getProjectin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
getProjectin interfaceSession
-
getProperties
public Map<String,Object> getProperties()
ADVANCED: Allow for user defined properties.- Specified by:
getPropertiesin 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:
getPropertyin interfaceSession
-
getQueries
public Map<String,List<DatabaseQuery>> getQueries()
ADVANCED: Return all pre-defined queries.- Specified by:
getQueriesin 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:
getQueryin 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:
getSessionLogin 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:
handleExceptionin interfaceCommandProcessor- Specified by:
handleExceptionin 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:
hasDescriptorin interfaceSession
-
hasExceptionHandler
public boolean hasExceptionHandler()
PUBLIC: Return if an exception handler is present.- Specified by:
hasExceptionHandlerin 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:
hasExternalTransactionControllerin 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:
isClientSessionin 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:
isConnectedin interfaceSession
-
isDatabaseSession
public boolean isDatabaseSession()
PUBLIC: Return if this session is a database session.- Specified by:
isDatabaseSessionin interfaceSession
-
isDistributedSession
public boolean isDistributedSession()
PUBLIC: Return if this session is a distributed session.- Specified by:
isDistributedSessionin interfaceSession
-
isInProfile
public boolean isInProfile()
PUBLIC: Return if a profiler is being used.- Specified by:
isInProfilein 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:
isFinalizersEnabledin 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:
setIsFinalizersEnabledin 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:
isRemoteSessionin interfaceSession
-
isRemoteUnitOfWork
public boolean isRemoteUnitOfWork()
PUBLIC: Return if this session is a unit of work.- Specified by:
isRemoteUnitOfWorkin interfaceSession
-
isServerSession
public boolean isServerSession()
PUBLIC: Return if this session is a server session.- Specified by:
isServerSessionin interfaceSession
-
isSessionBroker
public boolean isSessionBroker()
PUBLIC: Return if this session is a session broker.- Specified by:
isSessionBrokerin 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:
isUnitOfWorkin interfaceSession
-
getId
public Object getId(Object domainObject) throws ValidationException
ADVANCED: Extract and return the primary key from the object.- Specified by:
getIdin 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:
logMessagein 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:
readAllObjectsin 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:
readAllObjectsin 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:
readAllObjectsin 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:
readObjectin 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:
readObjectin 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:
readObjectin 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:
readObjectin 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:
refreshObjectin 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:
removePropertyin interfaceSession
-
removeQuery
public void removeQuery(String queryName)
PUBLIC: Remove all queries with the given queryName regardless of the argument types.- Specified by:
removeQueryin 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, ConcurrencyExceptionPUBLIC: 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:
setExceptionHandlerin interfaceSession
-
setExternalTransactionController
public void setExternalTransactionController(ExternalTransactionController externalTransactionController)
Used for JTS integration internally by ServerPlatform.- Specified by:
setExternalTransactionControllerin interfaceSession- See Also:
CustomServerPlatform
-
setIntegrityChecker
public void setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC: set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.- Specified by:
setIntegrityCheckerin 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:
setLogin 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:
setQueryTimeoutDefaultin interfaceSession
-
setQueryTimeoutUnitDefault
public void setQueryTimeoutUnitDefault(TimeUnit queryTimeoutUnitDefault)
Description copied from interface:SessionPUBLIC: 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:
setQueryTimeoutUnitDefaultin interfaceSession
-
setProfiler
public void setProfiler(SessionProfiler profiler)
PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.- Specified by:
setProfilerin 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.
-
setProperty
public void setProperty(String propertyName, Object propertyValue)
PUBLIC: Allow for user defined properties.- Specified by:
setPropertyin 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:
setSessionLogin 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:
shouldLogMessagesin interfaceSession
-
startOperationProfile
public void startOperationProfile(String operationName)
INTERNAL: Start the operation timing.- Specified by:
startOperationProfilein 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:
validateCachein 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:
processCommandin 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:
getCommandManagerin 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:
setCommandManagerin 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:
shouldLogMessagesin 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:
logMessagein 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:
getLogLevelin 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:
getLogLevelin interfaceSession- Returns:
- the log level
- See Also:
SessionLog
-
setLogLevel
public void setLogLevel(int level)
PUBLIC:Set the log level
- Specified by:
setLogLevelin interfaceCoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>- Specified by:
setLogLevelin 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:
shouldLogin 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:
handleSeverein 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:
getDefaultReferenceModein 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:
setDefaultReferenceModein 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.
-
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.
-
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:
getPartitioningPolicyin 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:
setPartitioningPolicyin 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.
-
-