All Implemented Interfaces:
Serializable, Cloneable, CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>, CommandProcessor, Session
Direct Known Subclasses:
ClientSession, DatabaseSessionImpl, HistoricalSession, UnitOfWorkImpl

Implementation of org.eclipse.persistence.sessions.Session The public interface should be used.
See Also:
  • Field Details

    • 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.
    • properties

      protected Map<String,Object> properties
      Allow for user defined properties.
    • 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:
    • 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 Details

    • 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 Details

    • getSerializer

      public Serializer getSerializer()
      Return the Serializer to use by default for serialization.
      Specified by:
      getSerializer in interface Session
    • setSerializer

      public void setSerializer(Serializer serializer)
      Set the Serializer to use by default for serialization.
      Specified by:
      setSerializer in interface Session
    • 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 when true and turned on when false.
    • isLoggingOff

      public boolean isLoggingOff()
      INTERNAL: PERF: Used for quick check if logging is OFF entirely.
    • getNextQueryId

      public long getNextQueryId()
      INTERNAL: Called by a sessions queries to obtain individual query ids. CR #2698903
    • acquireNonSynchronizedUnitOfWork

      public UnitOfWorkImpl acquireNonSynchronizedUnitOfWork()
      INTERNAL: Return a unit of work for this session not registered with the JTS transaction.
    • acquireNonSynchronizedUnitOfWork

      public UnitOfWorkImpl acquireNonSynchronizedUnitOfWork(ReferenceMode referenceMode)
      INTERNAL: Return a unit of work for this session not registered with the JTS transaction.
    • acquireHistoricalSession

      public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
      INTERNAL: Constructs a HistoricalSession given a valid AsOfClause.
      Specified by:
      acquireHistoricalSession in interface Session
      Parameters:
      clause - Represents a valid snap shot time.
      Throws:
      ValidationException - if this not a ClientSession, plain Session, or SessionBroker.
      See Also:
    • acquireUnitOfWork

      public UnitOfWorkImpl acquireUnitOfWork()
      PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit.
      Specified by:
      acquireUnitOfWork in interface Session
      See Also:
    • 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:
    • acquireUnitOfWork

      public UnitOfWorkImpl acquireUnitOfWork(ReferenceMode referenceMode)
      PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit.
      Specified by:
      acquireUnitOfWork in interface Session
      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:
    • addAlias

      public void addAlias(String alias, ClassDescriptor descriptor)
      PUBLIC: Add an alias for the descriptor
    • addJPAQuery

      public void addJPAQuery(DatabaseQuery query)
      INTERNAL: Return all pre-defined not yet parsed EJBQL queries.
      Specified by:
      addJPAQuery in interface Session
    • 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.
      Specified by:
      addQuery in interface Session
    • addQuery

      public void addQuery(String name, DatabaseQuery query, boolean replace)
      PUBLIC: Add the query to the session queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
    • addStaticMetamodelClass

      public void addStaticMetamodelClass(String modelClassName, String metamodelClassName)
      INTERNAL: Add a metamodel class to model class reference.
    • addTablePerTenantDescriptor

      protected void addTablePerTenantDescriptor(ClassDescriptor descriptor)
      INTERNAL: Add a descriptor that is uses a table per tenant multitenant policy.
    • addTablePerTenantQuery

      protected void addTablePerTenantQuery(DatabaseQuery query)
      INTERNAL: Add a query that queries a table per tenant entity
    • basicBeginTransaction

      protected void basicBeginTransaction() throws DatabaseException
      INTERNAL: Called by beginTransaction() to start a transaction. This starts a real database transaction. Allows retry if the connection is dead.
      Throws:
      DatabaseException
    • basicBeginTransaction

      protected void basicBeginTransaction(Accessor accessor) throws DatabaseException
      INTERNAL: Called by beginTransaction() to start a transaction. This starts a real database transaction. Allows retry if the connection is dead.
      Throws:
      DatabaseException
    • retryTransaction

      public DatabaseException retryTransaction(Accessor accessor, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
      INTERNAL: A begin transaction failed. Re-connect and retry the begin transaction.
    • releaseJTSConnection

      public void releaseJTSConnection()
      INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener. Close the managed sql connection corresponding to the external transaction, if applicable releases accessor.
    • basicCommitTransaction

      protected void basicCommitTransaction() throws DatabaseException
      INTERNAL: Called by commitTransaction() to commit a transaction. This commits the active transaction.
      Throws:
      DatabaseException
    • basicRollbackTransaction

      protected void basicRollbackTransaction() throws DatabaseException
      INTERNAL: Called by rollbackTransaction() to rollback a transaction. This rolls back the active transaction.
      Throws:
      DatabaseException
    • beginExternalTransaction

      public boolean beginExternalTransaction()
      INTERNAL: Attempts to begin an external transaction. Returns true only in one case - external transaction has been internally started during this method call: wasJTSTransactionInternallyStarted()==false in the beginning of this method and wasJTSTransactionInternallyStarted()==true in the end of this method.
    • beginTransaction

      public void beginTransaction() throws DatabaseException, ConcurrencyException
      PUBLIC: Begin a transaction on the database. This allows a group of database modification to be committed or rolled back as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.
      Throws:
      DatabaseException - if the database connection is lost or the begin is rejected.
      ConcurrencyException - if this session's transaction is acquired by another thread and a timeout occurs.
      See Also:
    • 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:
      clearIntegrityChecker in interface Session
    • clearLastDescriptorAccessed

      public void clearLastDescriptorAccessed()
      INTERNAL: Clear the the lastDescriptorAccessed cache.
    • clearDescriptors

      public void clearDescriptors()
      INTERNAL: Clear the the descriptors cache.
    • clearProfile

      public void clearProfile()
      PUBLIC: Clear the profiler, this will end the current profile operation.
      Specified by:
      clearProfile in interface Session
    • clone

      public Object clone()
      INTERNAL: Clones the descriptor
      Overrides:
      clone in class Object
    • commitExternalTransaction

      public boolean commitExternalTransaction()
      INTERNAL: Attempts to commit the running internally started external transaction. Returns true only in one case - external transaction has been internally committed during this method call: wasJTSTransactionInternallyStarted()==true in the beginning of this method and wasJTSTransactionInternallyStarted()==false in the end of this method.
    • commitTransaction

      public void commitTransaction() throws DatabaseException, ConcurrencyException
      PUBLIC: Commit the active database transaction. This allows a group of database modification to be committed or rolled back as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.
      Throws:
      DatabaseException - most databases validate changes as they are done, normally errors do not occur on commit unless the disk fails or the connection is lost.
      ConcurrencyException - if this session is not within a transaction.
    • compareObjects

      public boolean compareObjects(Object firstObject, Object secondObject)
      INTERNAL: Return if the two object match completely. This checks the objects attributes and their private parts.
    • compareObjectsDontMatch

      public boolean compareObjectsDontMatch(Object firstObject, Object secondObject)
      TESTING: Return true if the object do not match. This checks the objects attributes and their private parts.
    • containsQuery

      public boolean containsQuery(String queryName)
      PUBLIC: Return true if the pre-defined query is defined on the session.
      Specified by:
      containsQuery in interface Session
    • copy

      public Object copy(Object originalObjectOrObjects)
      PUBLIC: Return a complete copy of the object or of collection of objects. In case of collection all members should be either entities of the same type or have a common inheritance hierarchy mapped root class. This can be used to obtain a scratch copy of an object, or for templatizing an existing object into another new object. The object and all of its privately owned parts will be copied.
      Specified by:
      copy in interface Session
      See Also:
    • 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.
      Specified by:
      copy in interface Session
    • copyInternal

      public Object copyInternal(Object originalObject, CopyGroup copyGroup)
      INTERNAL:
    • 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:
    • doesObjectExist

      public boolean doesObjectExist(Object object) throws DatabaseException
      PUBLIC: Return if the object exists on the database or not. This always checks existence on the database.
      Specified by:
      doesObjectExist in interface Session
      Throws:
      DatabaseException
    • dontLogMessages

      public void dontLogMessages()
      PUBLIC: Turn off logging
      Specified by:
      dontLogMessages in interface Session
    • endOperationProfile

      public void endOperationProfile(String operationName)
      INTERNAL: End the operation timing.
      Specified by:
      endOperationProfile in interface CommandProcessor
    • endOperationProfile

      public void endOperationProfile(String operationName, DatabaseQuery query, int weight)
      INTERNAL: End the operation timing.
    • updateProfile

      public void updateProfile(String operationName, Object value)
      INTERNAL: Updates the value of SessionProfiler state
      Specified by:
      updateProfile in interface CommandProcessor
    • updateTablePerTenantDescriptors

      public void updateTablePerTenantDescriptors(String property, Object value)
      INTERNAL: Set the table per tenant. This should be called per client session after the start of a transaction. From JPA this method is called on the entity manager by setting the multitenant table per tenant property.
    • incrementProfile

      public void incrementProfile(String operationName)
      INTERNAL: Updates the count of SessionProfiler event
      Specified by:
      incrementProfile in interface CommandProcessor
    • 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:
      executeNonSelectingCall in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeNonSelectingSQL

      public void executeNonSelectingSQL(String sqlString) throws DatabaseException
      PUBLIC: Execute the sql on the database.

      Example:

      session.executeNonSelectingSQL("Delete from Employee");

      Specified by:
      executeNonSelectingSQL in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Class<?> domainClass) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Class<?> domainClass, Object arg1) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2, Object arg3) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Class<?> domainClass, List argumentValues) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • 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:
    • executeQuery

      public Object executeQuery(String queryName, Object arg1) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Object arg1, Object arg2) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, Object arg1, Object arg2, Object arg3) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(String queryName, List argumentValues) throws DatabaseException
      PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • 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:
    • executeQuery

      public Object executeQuery(DatabaseQuery query) throws DatabaseException
      PUBLIC: Execute the database query. A query is a database operation such as reading or writing. The query allows for the operation to be customized for such things as, performance, depth, caching, etc.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeQuery

      public Object executeQuery(DatabaseQuery query, List argumentValues) throws DatabaseException
      PUBLIC: Return the results from executing the database query. The query arguments are passed in as a List of argument values in the same order as the query arguments.
      Specified by:
      executeQuery in interface Session
      Throws:
      DatabaseException
    • executeQuery

      public Object executeQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException
      INTERNAL: Return the results from executing the database query. the arguments should be a database row with raw data values.
      Throws:
      DatabaseException
    • executeQuery

      public Object executeQuery(DatabaseQuery query, AbstractRecord row, int retryCount) throws DatabaseException
      INTERNAL: Return the results from executing the database query. the arguments should be a database row with raw data values.
      Throws:
      DatabaseException
    • retryQuery

      public Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
      INTERNAL: A query execution failed due to an invalid query. Re-connect and retry the query.
    • executeSelectingCall

      public Vector executeSelectingCall(Call call) throws DatabaseException
      PUBLIC: Execute the call on the database and return the result. The call must return a value, if no value is return executeNonSelectCall must be used. The call can be a stored procedure call, SQL call or other type of call. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.

      Example:

      session.executeSelectingCall(new SQLCall("Select * from Employee");

      Specified by:
      executeSelectingCall in interface Session
      Throws:
      DatabaseException
      See Also:
    • executeSQL

      public Vector executeSQL(String sqlString) throws DatabaseException
      PUBLIC: Execute the sql on the database and return the result. It must return a value, if no value is return executeNonSelectingSQL must be used. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

      Example:

      session.executeSelectingCall("Select * from Employee");

      Specified by:
      executeSQL in interface Session
      Throws:
      DatabaseException
      See Also:
    • getAccessor

      public Accessor getAccessor()
      INTERNAL: This should normally not be used, most sessions do not have a single accessor. ServerSession has a set of connection pools. ClientSession only has an accessor during a transaction. SessionBroker has multiple accessors. getAccessors() should be used to support partitioning. To maintain backward compatibility, and to support certain cases that required a default accessor, this returns the first accessor.
    • getAccessors

      public Collection<Accessor> getAccessors()
      INTERNAL: This should normally not be used, most sessions do not have specific accessors. ServerSession has a set of connection pools. ClientSession only has an accessor during a transaction. SessionBroker has multiple accessors. getAccessors() is used to support partitioning. If the accessor is null, this lazy initializes one for backwardcompatibility with DatabaseSession.
    • getAccessors

      public Collection<Accessor> getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)
      INTERNAL: Return the connections to use for the query execution.
    • basicExecuteCall

      public Object basicExecuteCall(Call call, AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
      INTERNAL: Execute the call on each accessors and merge the results.
      Throws:
      DatabaseException
    • getActiveCommandThreads

      public ExposedNodeLinkedList getActiveCommandThreads()
      INTERNAL:
    • getActiveSession

      public Session getActiveSession()
      PUBLIC: Return the active session for the current active external (JTS) transaction. This should only be used with JTS and will return the session if no external transaction exists.
      Specified by:
      getActiveSession in interface Session
    • getActiveUnitOfWork

      public UnitOfWork getActiveUnitOfWork()
      PUBLIC: Return the active unit of work for the current active external (JTS) transaction. This should only be used with JTS and will return null if no external transaction exists.
      Specified by:
      getActiveUnitOfWork in interface Session
    • getAliasDescriptors

      public Map getAliasDescriptors()
      INTERNAL: Returns the alias descriptors Map.
    • getAsOfClause

      public AsOfClause getAsOfClause()
      ADVANCED: Answers the past time this session is as of. Indicates whether or not this is a special historical session where all objects are read relative to a particular point in time.
      Specified by:
      getAsOfClause in interface Session
      Returns:
      An immutable object representation of the past time. null if no clause set, or this a regular session.
      See Also:
    • 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 at this is acceptable. Sometimes true if want to move to the first valid session, i.e. executing on ClientSession when really should be on ServerSession.
      terminalOnly - return the session we will execute the call on, not the next step towards it.
      Returns:
      this if there is no next link in the chain
    • getParentIdentityMapSession

      public AbstractSession getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)
      INTERNAL: Returns the appropriate IdentityMap session for this descriptor. Sessions can be chained and each session can have its own Cache/IdentityMap. Entities can be stored at different levels based on Cache Isolation. This method will return the correct Session for a particular Entity class based on the Isolation Level and the attributes provided.
      Parameters:
      canReturnSelf - true when method calls itself. If the path starting at this is acceptable. Sometimes true if want to move to the first valid session, i.e. executing on ClientSession when really should be on ServerSession.
      terminalOnly - return the last session in the chain where the Enitity is stored.
      Returns:
      Session with the required IdentityMap
    • getPessimisticLockTimeoutDefault

      public Integer getPessimisticLockTimeoutDefault()
      INTERNAL: Returns the default pessimistic lock timeout value.
    • getPessimisticLockTimeoutUnitDefault

      public TimeUnit getPessimisticLockTimeoutUnitDefault()
    • getQueryTimeoutDefault

      public int getQueryTimeoutDefault()
      PUBLIC: Return the default query timeout for this session. This timeout will apply to any queries that do not have a timeout set, and that do not have a default timeout defined in their descriptor.
    • getQueryTimeoutUnitDefault

      public TimeUnit getQueryTimeoutUnitDefault()
    • getInjectionManager

      public <T> InjectionManager<T> getInjectionManager()
    • getExecutionSession

      public AbstractSession getExecutionSession(DatabaseQuery query)
      INTERNAL: Gets the session which this query will be executed on. Generally will be called immediately before the call is translated, which is immediately before session.executeCall.

      Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.

      Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.

      Parameters:
      query - may store session name or reference class for brokers case
      Returns:
      a session with a live accessor
    • hasCommitManager

      public boolean hasCommitManager()
      INTERNAL: Return if the commit manager has been set.
    • getCommitManager

      public CommitManager getCommitManager()
      INTERNAL: The commit manager is used to resolve referential integrity on commits of multiple objects. All brokered sessions share the same commit manager.
    • getDefaultReadOnlyClasses

      public Vector getDefaultReadOnlyClasses()
      INTERNAL: Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.
      See Also:
    • getClassDescriptor

      public ClassDescriptor getClassDescriptor(Class<?> theClass)
      ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class. If a descriptor does not exist for the Class parameter, null is returned. If the passed Class parameter is null, then null will be returned.
      Specified by:
      getClassDescriptor in interface Session
    • getClassDescriptor

      public ClassDescriptor getClassDescriptor(Object domainObject)
      ADVANCED: Return the descriptor specified for the object's class. If a descriptor does not exist for the Object parameter, null is returned. If the passed Object parameter is null, then null will be returned.
      Specified by:
      getClassDescriptor in interface Session
    • getClassDescriptorForAlias

      public ClassDescriptor getClassDescriptorForAlias(String alias)
      PUBLIC: Return the descriptor for the alias. UnitOfWork delegates this to the parent
      Specified by:
      getClassDescriptorForAlias in interface Session
    • getDescriptor

      public ClassDescriptor getDescriptor(Class<?> theClass)
      ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class. If the passed Class is null, null will be returned.
      Specified by:
      getDescriptor in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getDescriptor in interface Session
    • getDescriptor

      public ClassDescriptor getDescriptor(Object domainObject)
      ADVANCED: Return the descriptor specified for the object's class. If the passed Object is null, null will be returned.
      Specified by:
      getDescriptor in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getDescriptor in interface Session
    • getDescriptorForAlias

      public ClassDescriptor getDescriptorForAlias(String alias)
      PUBLIC: Return the descriptor for the alias.
      Specified by:
      getDescriptorForAlias in interface Session
      Parameters:
      alias - The descriptor alias.
      Returns:
      The descriptor for the alias or null if no descriptor was found.
    • getDescriptors

      public Map<Class<?>,ClassDescriptor> getDescriptors()
      ADVANCED: Return all registered descriptors.
      Specified by:
      getDescriptors in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getDescriptors in interface Session
      Specified by:
      getDescriptors in class CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
    • hasEventManager

      public boolean hasEventManager()
      INTERNAL: Return if an event manager has been set.
    • getEventManager

      public SessionEventManager getEventManager()
      PUBLIC: Return the event manager. The event manager can be used to register for various session events.
      Specified by:
      getEventManager in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getEventManager in interface Session
    • getExceptionHandlerClass

      public String getExceptionHandlerClass()
      INTERNAL: Return a string which represents my ExceptionHandler's class Added for F2104: Properties.xml - gn
    • getExceptionHandler

      public ExceptionHandler getExceptionHandler()
      PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.
      Specified by:
      getExceptionHandler in interface Session
    • getExternalTransactionController

      public ExternalTransactionController getExternalTransactionController()
      PUBLIC: Used for JTS integration. If your application requires to have JTS control transactions instead of EclipseLink an external transaction controller must be specified. EclipseLink provides JTS controllers for several JTS implementations including JTS 1.0, Weblogic 5.1 and WebSphere 3.0.
      Specified by:
      getExternalTransactionController in interface Session
      See Also:
    • getIdentityMapAccessor

      public IdentityMapAccessor getIdentityMapAccessor()
      PUBLIC: The IdentityMapAccessor is the preferred way of accessing IdentityMap funcitons This will return an object which implements an interface which exposes all public IdentityMap functions.
      Specified by:
      getIdentityMapAccessor in interface Session
    • getIdentityMapAccessorInstance

      public IdentityMapAccessor getIdentityMapAccessorInstance()
      INTERNAL: Return the internally available IdentityMapAccessor instance.
    • getIntegrityChecker

      public IntegrityChecker getIntegrityChecker()
      PUBLIC: Returns the integrityChecker.IntegrityChecker holds all the ClassDescriptor Exceptions.
      Specified by:
      getIntegrityChecker in interface Session
    • getJPAQueries

      public List<DatabaseQuery> getJPAQueries()
      ADVANCED: Return all pre-defined not yet parsed JPQL queries.
      Specified by:
      getJPAQueries in interface Session
    • getJPATablePerTenantQueries

      public List<DatabaseQuery> getJPATablePerTenantQueries()
      ADVANCED: Return all pre-defined not yet parsed JPQL queries.
    • getLog

      public Writer getLog()
      PUBLIC: Return the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging, logMessages must be turned on.
      Specified by:
      getLog in interface Session
      See Also:
    • 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.
      Specified by:
      getLogin in interface Session
    • getDatasourceLogin

      public Login getDatasourceLogin()
      PUBLIC: Return the login, the login holds any database connection information given. This return the Login interface and may need to be cast to the datasource specific implementation.
      Specified by:
      getDatasourceLogin in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getDatasourceLogin in interface Session
    • 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.
      Specified by:
      getName in interface Session
    • getNextSequenceNumberValue

      public Number getNextSequenceNumberValue(Class<?> domainClass)
      ADVANCED: Return the sequnce number from the database
      Specified by:
      getNextSequenceNumberValue in interface Session
    • getNumberOfActiveUnitsOfWork

      public int getNumberOfActiveUnitsOfWork()
      INTERNAL: Return the number of units of work connected.
    • getCacheKeyFromTargetSessionForMerge

      protected CacheKey getCacheKeyFromTargetSessionForMerge(Object implementation, ObjectBuilder builder, ClassDescriptor descriptor, MergeManager mergeManager)
      INTERNAL: For use within the merge process this method will get an object from the shared cache using a readlock. If a readlock is unavailable then the merge manager will be transitioned to deferred locks and a deferred lock will be used.
    • getPlatform

      public DatabasePlatform getPlatform()
      INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior. NOTE: this must only be used for relational specific usage, it will fail for non-relational datasources.
      Specified by:
      getPlatform in interface Session
    • getLoader

      public ClassLoader getLoader()
      INTERNAL: Return the class loader for the session's application. This loader should be able to load any application or EclipseLink class.
    • getDatasourcePlatform

      public Platform getDatasourcePlatform()
      INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior.
      Specified by:
      getDatasourcePlatform in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getDatasourcePlatform in interface Session
      Specified by:
      getDatasourcePlatform in class CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
    • getServerPlatform

      public ServerPlatform getServerPlatform()
      INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within EclipseLink's other sessions types (ie not DatabaseSession)
      Specified by:
      getServerPlatform in interface Session
    • getPlatform

      public Platform getPlatform(Class<?> domainClass)
      INTERNAL: Return the database platform currently connected to for specified class. The platform is used for database specific behavior.
      Specified by:
      getPlatform in class CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
    • getProfiler

      public SessionProfiler getProfiler()
      PUBLIC: Return the profiler. The profiler is a tool that can be used to determine performance bottlenecks. The profiler can be queries to print summaries and configure for logging purposes.
      Specified by:
      getProfiler in interface Session
    • getProject

      public Project getProject()
      PUBLIC: Return the project, the project holds configuartion information including the descriptors.
      Specified by:
      getProject in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      getProject in interface Session
    • getProperties

      public Map<String,Object> getProperties()
      ADVANCED: Allow for user defined properties.
      Specified by:
      getProperties in interface Session
    • hasProperties

      public boolean hasProperties()
      INTERNAL: Allow to check for user defined properties.
    • hasTablePerTenantDescriptors

      public boolean hasTablePerTenantDescriptors()
      INTERNAL: Return list of table per tenant multitenant descriptors.
    • hasTablePerTenantQueries

      public boolean hasTablePerTenantQueries()
      INTERNAL: Return a list of table per tenant multitenant queries.
    • getProperty

      public Object getProperty(String name)
      ADVANCED: Returns the user defined property.
      Specified by:
      getProperty in interface Session
    • getQueries

      public Map<String,List<DatabaseQuery>> getQueries()
      ADVANCED: Return all pre-defined queries.
      Specified by:
      getQueries in interface Session
    • 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:
    • 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.
      Specified by:
      getQuery in interface Session
    • getQuery

      public DatabaseQuery getQuery(String name, List arguments)
      PUBLIC: Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments.
      Specified by:
      getQuery in interface Session
      See Also:
    • 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

      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:
    • getSequencing

      public Sequencing getSequencing()
      INTERNAL: Return the Sequencing object used by the session.
    • getSessionForClass

      public AbstractSession getSessionForClass(Class<?> domainClass)
      INTERNAL: Return the session to be used for the class. Used for compatibility with the session broker.
    • getSessionForName

      public AbstractSession getSessionForName(String name) throws ValidationException
      INTERNAL: Return the session by name. Used for compatibility with the session broker.
      Throws:
      ValidationException
    • getSessionLog

      public SessionLog getSessionLog()
      PUBLIC: Return the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, logMessages must be turned on.
      Specified by:
      getSessionLog in interface Session
      See Also:
    • getTablePerTenantDescriptors

      public List<ClassDescriptor> getTablePerTenantDescriptors()
      INTERNAL: Return list of table per tenant multitenant descriptors.
    • getTablePerTenantQueries

      public List<DatabaseQuery> getTablePerTenantQueries()
      INTERNAL: Return list of table per tenant multitenant descriptors.
    • getTransactionMutex

      public ConcurrencyManager getTransactionMutex()
      INTERNAL: The transaction mutex ensure mutual exclusion on transaction across multiple threads.
    • handleException

      public Object handleException(RuntimeException exception) throws RuntimeException
      PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.
      Specified by:
      handleException in interface CommandProcessor
      Specified by:
      handleException in interface Session
      Parameters:
      exception - The exception being thrown
      Returns:
      An object that is not currently used
      Throws:
      RuntimeException
    • hasBroker

      public boolean hasBroker()
      INTERNAL: Allow the session to be used from a session broker.
    • hasDescriptor

      public boolean hasDescriptor(Class<?> theClass)
      ADVANCED: Return true if a descriptor exists for the given class.
      Specified by:
      hasDescriptor in interface Session
    • hasExceptionHandler

      public boolean hasExceptionHandler()
      PUBLIC: Return if an exception handler is present.
      Specified by:
      hasExceptionHandler in interface Session
    • hasExternalTransactionController

      public boolean hasExternalTransactionController()
      PUBLIC: Used for JTA integration. If your application requires to have JTA control transactions instead of EclipseLink an external transaction controler must be specified. EclipseLink provides JTA controlers for JTA 1.0 and application servers.
      Specified by:
      hasExternalTransactionController in interface Session
      See Also:
    • 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:
    • internalExecuteQuery

      public Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException
      INTERNAL: Return the results from exeucting the database query. The arguments should be a database row with raw data values. This method is provided to allow subclasses to change the default querying behavior. All querying goes through this method.
      Throws:
      DatabaseException
    • isBroker

      public boolean isBroker()
      INTERNAL: Returns true if the session is a session Broker.
    • isInBroker

      public boolean isInBroker()
      INTERNAL: Returns true if the session is in a session Broker.
    • isClassReadOnly

      public boolean isClassReadOnly(Class<?> theClass)
      PUBLIC: Return if the class is defined as read-only.
    • isClassReadOnly

      public boolean isClassReadOnly(Class<?> theClass, ClassDescriptor descriptor)
      INTERNAL: Return if the class is defined as read-only. PERF: Pass descriptor to avoid re-lookup.
    • isClientSession

      public boolean isClientSession()
      PUBLIC: Return if this session is a client session.
      Specified by:
      isClientSession in interface Session
    • isIsolatedClientSession

      public boolean isIsolatedClientSession()
      PUBLIC: Return if this session is an isolated client session.
    • isExclusiveIsolatedClientSession

      public boolean isExclusiveIsolatedClientSession()
      PUBLIC: Return if this session is an exclusive isolated client session.
    • isConnected

      public boolean isConnected()
      PUBLIC: Return if this session is connected to the database.
      Specified by:
      isConnected in interface Session
    • isDatabaseSession

      public boolean isDatabaseSession()
      PUBLIC: Return if this session is a database session.
      Specified by:
      isDatabaseSession in interface Session
    • isDistributedSession

      public boolean isDistributedSession()
      PUBLIC: Return if this session is a distributed session.
      Specified by:
      isDistributedSession in interface Session
    • isInProfile

      public boolean isInProfile()
      PUBLIC: Return if a profiler is being used.
      Specified by:
      isInProfile in interface Session
    • setIsInProfile

      public void setIsInProfile(boolean inProfile)
      PUBLIC: Allow for user deactive a profiler
    • setIsInBroker

      public void setIsInBroker(boolean isInBroker)
      INTERNAL: Set if this session is contained in a SessionBroker.
    • isFinalizersEnabled

      public boolean isFinalizersEnabled()
      PUBLIC: Return if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons.
      Specified by:
      isFinalizersEnabled in interface Session
    • registerFinalizer

      public void registerFinalizer()
      INTERNAL: Register a finalizer to release this session.
    • isHistoricalSession

      public boolean isHistoricalSession()
      INTERNAL: Return if this session is a historical session.
    • setIsFinalizersEnabled

      public void setIsFinalizersEnabled(boolean isFinalizersEnabled)
      PUBLIC: Set if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons.
      Specified by:
      setIsFinalizersEnabled in interface Session
    • isInTransaction

      public boolean isInTransaction()
      PUBLIC: Return if the session is currently in the progress of a database transaction. Because nested transactions are allowed check if the transaction mutex has been aquired.
    • isJPAQueriesProcessed

      public boolean isJPAQueriesProcessed()
      INTERNAL: used to see if JPA Queries have been processed during initialization
    • isProtectedSession

      public boolean isProtectedSession()
      PUBLIC: Returns true if Protected Entities should be built within this session
    • isRemoteSession

      public boolean isRemoteSession()
      PUBLIC: Return if this session is remote.
      Specified by:
      isRemoteSession in interface Session
    • isRemoteUnitOfWork

      public boolean isRemoteUnitOfWork()
      PUBLIC: Return if this session is a unit of work.
      Specified by:
      isRemoteUnitOfWork in interface Session
    • isServerSession

      public boolean isServerSession()
      PUBLIC: Return if this session is a server session.
      Specified by:
      isServerSession in interface Session
    • isSessionBroker

      public boolean isSessionBroker()
      PUBLIC: Return if this session is a session broker.
      Specified by:
      isSessionBroker in interface Session
    • isSynchronized

      public boolean isSynchronized()
      INTERNAL: Return if this session is synchronized.
    • isUnitOfWork

      public boolean isUnitOfWork()
      PUBLIC: Return if this session is a unit of work.
      Specified by:
      isUnitOfWork in interface Session
    • getId

      public Object getId(Object domainObject) throws ValidationException
      ADVANCED: Extract and return the primary key from the object.
      Specified by:
      getId in interface Session
      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.
      Specified by:
      log in interface Session
    • logMessage

      public void logMessage(String message)
      Log a untranslated message to the EclipseLink log at FINER level.
      Specified by:
      logMessage in interface Session
    • prepareDatabaseQuery

      public DatabaseQuery prepareDatabaseQuery(DatabaseQuery query)
      INTERNAL: A call back to do session specific preparation of a query.

      The call back occurs soon before we clone the query for execution, meaning that if this method needs to clone the query then the caller will determine that it doesn't need to clone the query itself.

    • readAllObjects

      public Vector readAllObjects(Class<?> domainClass) throws DatabaseException
      PUBLIC: Read all of the instances of the class from the database. This operation can be customized through using a ReadAllQuery, or through also passing in a selection criteria.
      Specified by:
      readAllObjects in interface Session
      Throws:
      DatabaseException
      See Also:
    • 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:
    • readAllObjects

      public Vector readAllObjects(Class<?> referenceClass, Call aCall) throws DatabaseException
      PUBLIC: Read all the instances of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));
      Specified by:
      readAllObjects in interface Session
      Throws:
      DatabaseException
      See Also:
    • readAllObjects

      public Vector readAllObjects(Class<?> domainClass, Expression expression) throws DatabaseException
      PUBLIC: Read all of the instances of the class from the database matching the given expression. This operation can be customized through using a ReadAllQuery.
      Specified by:
      readAllObjects in interface Session
      Throws:
      DatabaseException
      See Also:
    • readObject

      public Object readObject(Class<?> domainClass) throws DatabaseException
      PUBLIC: Read the first instance of the class from the database. This operation can be customized through using a ReadObjectQuery, or through also passing in a selection criteria.
      Specified by:
      readObject in interface Session
      Throws:
      DatabaseException
      See Also:
    • 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:
    • readObject

      public Object readObject(Class<?> domainClass, Call aCall) throws DatabaseException
      PUBLIC: Read the first instance of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));
      Specified by:
      readObject in interface Session
      Throws:
      DatabaseException
      See Also:
    • readObject

      public Object readObject(Class<?> domainClass, Expression expression) throws DatabaseException
      PUBLIC: Read the first instance of the class from the database matching the given expression. This operation can be customized through using a ReadObjectQuery.
      Specified by:
      readObject in interface Session
      Throws:
      DatabaseException
      See Also:
    • readObject

      public Object readObject(Object object) throws DatabaseException
      PUBLIC: Use the example object to consruct a read object query by the objects primary key. This will read the object from the database with the same primary key as the object or null if no object is found.
      Specified by:
      readObject in interface Session
      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

      public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException
      PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. The object will be pessimisticly locked on the database for the duration of the transaction.

      Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT

      Throws:
      DatabaseException
    • refreshObject

      public Object refreshObject(Object object) throws DatabaseException
      PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. This can be used to ensure the object is up to date with the database. Caution should be used when using this to make sure the application has no un commited changes to the object.
      Specified by:
      refreshObject in interface Session
      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.
      Specified by:
      release in interface Session
    • releaseUnitOfWork

      public void releaseUnitOfWork(UnitOfWorkImpl unitOfWork)
      INTERNAL: Release the unit of work, if lazy release the connection.
    • removeProperty

      public void removeProperty(String property)
      PUBLIC: Remove the user defined property.
      Specified by:
      removeProperty in interface Session
    • removeQuery

      public void removeQuery(String queryName)
      PUBLIC: Remove all queries with the given queryName regardless of the argument types.
      Specified by:
      removeQuery in interface Session
      See Also:
    • removeQuery

      public void removeQuery(String queryName, Vector argumentTypes)
      PUBLIC: Remove the specific query with the given queryName and argumentTypes.
    • rollbackExternalTransaction

      protected boolean rollbackExternalTransaction()
      PROTECTED: Attempts to rollback the running internally started external transaction. Returns true only in one case - extenal transaction has been internally rolled back during this method call: wasJTSTransactionInternallyStarted()==true in the beginning of this method and wasJTSTransactionInternallyStarted()==false in the end of this method.
    • rollbackTransaction

      public void rollbackTransaction() throws DatabaseException, ConcurrencyException
      PUBLIC: Rollback the active database transaction. This allows a group of database modification to be commited or rolledback as a unit. All writes/deletes will be sent to the database be will not be visible to other users until commit. Although databases do not allow nested transaction, EclipseLink supports nesting through only committing to the database on the outer commit.
      Throws:
      DatabaseException - if the database connection is lost or the rollback fails.
      ConcurrencyException - if this session is not within a transaction.
    • setAccessor

      public void setAccessor(Accessor accessor)
      INTERNAL: Set the accessor.
    • setBroker

      public void setBroker(AbstractSession broker)
      INTERNAL: Allow the session to be used from a session broker.
    • setCommitManager

      public void setCommitManager(CommitManager commitManager)
      INTERNAL: The commit manager is used to resolve referncial integrity on commits of multiple objects.
    • setInjectionManager

      public void setInjectionManager(InjectionManager<?> injectionManager)
    • setEventManager

      public void setEventManager(SessionEventManager eventManager)
      INTERNAL: Set the event manager. The event manager can be used to register for various session events.
    • setExceptionHandler

      public void setExceptionHandler(ExceptionHandler exceptionHandler)
      PUBLIC: Set the exceptionHandler. Exception handler can catch errors that occur on queries or during database access.
      Specified by:
      setExceptionHandler in interface Session
    • setExternalTransactionController

      public void setExternalTransactionController(ExternalTransactionController externalTransactionController)
      Used for JTS integration internally by ServerPlatform.
      Specified by:
      setExternalTransactionController in interface Session
      See Also:
    • setIntegrityChecker

      public void setIntegrityChecker(IntegrityChecker integrityChecker)
      PUBLIC: set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.
      Specified by:
      setIntegrityChecker in interface Session
    • setJPAQueriesProcessed

      public void setJPAQueriesProcessed(boolean jpaQueriesProcessed)
      INTERNAL: used to set if JPA Queries have been processed during initialization
    • setLog

      public void setLog(Writer log)
      PUBLIC: Set the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging logMessages() is used.
      Specified by:
      setLog in interface Session
      See Also:
    • 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.
      Specified by:
      setName in interface Session
    • setNumberOfActiveUnitsOfWork

      protected void setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)
    • setPessimisticLockTimeoutDefault

      public void setPessimisticLockTimeoutDefault(Integer pessimisticLockTimeoutDefault)
      PUBLIC: Set the default pessimistic lock timeout value. This value will be used to set the WAIT clause of a SQL SELECT FOR UPDATE statement. It defines how long EcliseLink should wait for a lock on the database row before aborting.
    • setPessimisticLockTimeoutUnitDefault

      public void setPessimisticLockTimeoutUnitDefault(TimeUnit pessimisticLockTimeoutUnitDefault)
    • setQueryTimeoutDefault

      public void setQueryTimeoutDefault(int queryTimeoutDefault)
      PUBLIC: Set the default query timeout for this session. This timeout will apply to any queries that do not have a timeout set, and that do not have a default timeout defined in their descriptor.
      Specified by:
      setQueryTimeoutDefault in interface Session
    • setQueryTimeoutUnitDefault

      public void setQueryTimeoutUnitDefault(TimeUnit queryTimeoutUnitDefault)
      Description copied from interface: Session
      PUBLIC: Set the default query timeout units for this session. This timeout unit will apply to any queries that do not have a unit value set, and that do not have a default timeout unit defined in their descriptor.
      Specified by:
      setQueryTimeoutUnitDefault in interface Session
    • setProfiler

      public void setProfiler(SessionProfiler profiler)
      PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.
      Specified by:
      setProfiler in interface Session
    • 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:
      setProperty in interface Session
    • setQueries

      public void setQueries(Map<String,List<DatabaseQuery>> queries)
      INTERNAL: Set the named queries.
    • setSessionLog

      public void setSessionLog(SessionLog sessionLog)
      PUBLIC: Set the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, log level can not be OFF. Also set a backpointer to this session in SessionLog.
      Specified by:
      setSessionLog in interface Session
      See Also:
    • setSynchronized

      public void setSynchronized(boolean synched)
      INTERNAL: Set isSynchronized flag to indicate that this session is synchronized. This method should only be called by setSynchronized methods of derived classes.
    • setTransactionMutex

      protected void setTransactionMutex(ConcurrencyManager transactionMutex)
    • setWasJTSTransactionInternallyStarted

      public void setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)
      INTERNAL: Return if a JTS transaction was started by the session. The session will start a JTS transaction if a unit of work or transaction is begun without a JTS transaction present.
    • shouldLogMessages

      public boolean shouldLogMessages()
      PUBLIC: Return if logging is enabled (false if log level is OFF)
      Specified by:
      shouldLogMessages in interface Session
    • startOperationProfile

      public void startOperationProfile(String operationName)
      INTERNAL: Start the operation timing.
      Specified by:
      startOperationProfile in interface CommandProcessor
    • 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.
      Overrides:
      toString in class Object
    • 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:
    • validateCache

      public void validateCache()
      ADVANCED: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.
      Specified by:
      validateCache in interface Session
    • 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.
      Throws:
      DatabaseException
      OptimisticLockException
    • 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:
    • writesCompleted

      public void writesCompleted()
      INTERNAL: This method notifies the accessor that a particular sets of writes has completed. This notification can be used for such thing as flushing the batch mechanism
    • processCommand

      public void processCommand(Object command)
      INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Process the remote command from the RCM. The command may have come from any remote session or application. Since this is a EclipseLink session we can always assume that the object that we receive here will be a Command object.
      Specified by:
      processCommand in interface CommandProcessor
      Parameters:
      command - Application formatted command to be processed
    • processJPAQueries

      public void processJPAQueries()
      INTERNAL: Process the JPA named queries into EclipseLink Session queries. This method is called after descriptor initialization. Temporarily made public for ODI. Should not be used elsewhere.
    • processJPAQuery

      protected void processJPAQuery(DatabaseQuery jpaQuery)
      INTERNAL: Process the JPA named query into an EclipseLink Session query. This method is called after descriptor initialization.
    • getCommandManager

      public CommandManager getCommandManager()
      PUBLIC: Return the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.
      Specified by:
      getCommandManager in interface CommandProcessor
      Returns:
      The CommandManager instance that controls the remote command service for this session
      See Also:
    • setCommandManager

      public void setCommandManager(CommandManager mgr)
      ADVANCED: Set the CommandManager that allows this session to act as a CommandProcessor and receive or propagate commands from/to the EclipseLink cluster.
      Specified by:
      setCommandManager in interface CommandProcessor
      Parameters:
      mgr - The CommandManager instance to control the remote command service for this session
      See Also:
    • 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:
    • 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:
    • shouldLogMessages

      public boolean shouldLogMessages(int logLevel)
      INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Return true if a message at the specified log level would be logged given the log level setting of this session. This can be used by the CommandManager to know whether it should even bother to create the localized strings and call the logMessage method, or if it would only find that the message would not be logged because the session level does not permit logging. The log level passed in will be one of the constants LOG_ERROR, LOG_WARNING, LOG_INFO, and LOG_DEBUG defined in the CommandProcessor interface.
      Specified by:
      shouldLogMessages in interface CommandProcessor
      Parameters:
      logLevel - A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG
      Returns:
      True if a message at the specified level should be logged and false if it should not
    • logMessage

      public void logMessage(int logLevel, String message)
      INTERNAL: RemoteCommandManager method. This is a required method in order to implement the CommandProcessor interface. Log the specified message string at the specified level if it should be logged given the log level setting in this session. The log level passed in will be one of the constants LOG_ERROR, LOG_WARNING, LOG_INFO, and LOG_DEBUG defined in the CommandProcessor interface.
      Specified by:
      logMessage in interface CommandProcessor
      Parameters:
      logLevel - A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG
      message - The message String that is to be logged
    • getLogLevel

      public int getLogLevel(String category)
      PUBLIC:

      Return the log level

      Specified by:
      getLogLevel in interface Session
      Parameters:
      category - the string representation of a EclipseLink category, e.g. "sql", "transaction" ...
      Returns:
      the log level
      See Also:
    • getLogLevel

      public int getLogLevel()
      PUBLIC:

      Return the log level

      Specified by:
      getLogLevel in interface Session
      Returns:
      the log level
      See Also:
    • setLogLevel

      public void setLogLevel(int level)
      PUBLIC:

      Set the log level

      Specified by:
      setLogLevel in interface CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
      Specified by:
      setLogLevel in interface Session
      Parameters:
      level - the new log level
      See Also:
    • shouldDisplayData

      public boolean shouldDisplayData()
      PUBLIC: Return true if SQL logging should log visible bind parameters. If the shouldDisplayData is not set, check the session log level and return true for a level greater than CONFIG.
    • shouldLog

      public boolean shouldLog(int level, String category)
      PUBLIC:

      Check if a message of the given level would actually be logged.

      Specified by:
      shouldLog in interface Session
      Parameters:
      level - the log request level
      category - the string representation of a EclipseLink category
      Returns:
      true if the given message level will be logged
      See Also:
    • 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 value
      category - the string representation of a EclipseLink category.
      message - the string message
    • 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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      param1 - a parameter of the message
      param2 - 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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      param1 - a parameter of the message
      param2 - second parameter of the message
      param3 - 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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      params - array of parameters to the message
      accessor - the connection that generated the log entry
    • 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 value
      category - the string representation of a EclipseLink category.
      message - the string message
      params - array of parameters to the message
      accessor - the connection that generated the log entry
      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 value
      category - the string representation of a EclipseLink category.
      throwable - a Throwable
    • severe

      public void severe(String message, String category)
      PUBLIC:

      This method is called when a severe level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • warning

      public void warning(String message, String category)
      PUBLIC:

      This method is called when a warning level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • info

      public void info(String message, String category)
      PUBLIC:

      This method is called when a info level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • config

      public void config(String message, String category)
      PUBLIC:

      This method is called when a config level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • fine

      public void fine(String message, String category)
      PUBLIC:

      This method is called when a fine level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • finer

      public void finer(String message, String category)
      PUBLIC:

      This method is called when a finer level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • finest

      public void finest(String message, String category)
      PUBLIC:

      This method is called when a finest level message needs to be logged. The message will be translated

      Parameters:
      message - the message key
    • handleSevere

      public Object handleSevere(RuntimeException exception) throws RuntimeException
      PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.
      Specified by:
      handleSevere in interface Session
      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

      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:
    • isExclusiveConnectionRequired

      public boolean isExclusiveConnectionRequired()
      INTERNAL: This method is called in case externalConnectionPooling is used. If returns true, accessor used by the session keeps its connection open until released by the session.
    • getDefaultReferenceMode

      public ReferenceMode getDefaultReferenceMode()
      Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.
      Specified by:
      getDefaultReferenceMode in interface Session
      See Also:
    • setDefaultReferenceMode

      public void setDefaultReferenceMode(ReferenceMode defaultReferenceMode)
      Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.
      Specified by:
      setDefaultReferenceMode in interface Session
      See Also:
    • 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:
      getPartitioningPolicy in interface Session
    • setPartitioningPolicy

      public void setPartitioningPolicy(PartitioningPolicy partitioningPolicy)
      PUBLIC: Set the session's partitioning policy. A PartitioningPolicy is used to partition, load-balance or replicate data across multiple difference databases or across a database cluster such as Oracle RAC. Partitioning can provide improved scalability by allowing multiple database machines to service requests.
      Specified by:
      setPartitioningPolicy in interface Session
    • 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.