Class DistributedSession

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean hasDefaultReadOnlyClasses
      Cache if default classes have been read from server.
      protected boolean isMetadataRemote
      Define if meta-data is initialized locally, or serialized from the server.
      protected org.eclipse.persistence.internal.sessions.remote.RemoteConnection remoteConnection
      Connection to remote persistence service.
      • Fields inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl

        connectedTime, databaseEventListener, isLoggedIn, sequencingHome, serverPlatform, tuner
      • Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession

        accessors, activeCommandThreads, attributeGroups, broker, commandManager, commitManager, defaultReferenceMode, deferredEvents, descriptors, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, injectionManager, integrityChecker, isConcurrent, isExecutingEvents, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueriesProcessed, lastDescriptorAccessed, logSessionString, metadatalistener, multitenantContextProperties, name, numberOfActiveUnitsOfWork, objectsLockedForClone, partitioningPolicy, pessimisticLockTimeoutDefault, pessimisticLockTimeoutUnitDefault, platform, profiler, project, properties, queries, queryBuilder, queryTimeoutDefault, queryTimeoutUnitDefault, serializer, sessionLog, shouldCheckWriteLock, shouldOptimizeResultSetAccess, shouldPropagateChanges, staticMetamodelClasses, tablePerTenantDescriptors, tablePerTenantQueries, tolerateInvalidJPQL, transactionMutex, wasJTSTransactionInternallyStarted
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DistributedSession​(int nothing)
      INTERNAL: Create a blank session, used for proxy session.
        DistributedSession​(org.eclipse.persistence.internal.sessions.remote.RemoteConnection remoteConnection)
      PUBLIC: Creates a DistributedSession.
    • Field Detail

      • remoteConnection

        protected transient org.eclipse.persistence.internal.sessions.remote.RemoteConnection remoteConnection
        Connection to remote persistence service.
      • hasDefaultReadOnlyClasses

        protected boolean hasDefaultReadOnlyClasses
        Cache if default classes have been read from server.
      • isMetadataRemote

        protected boolean isMetadataRemote
        Define if meta-data is initialized locally, or serialized from the server.
    • Constructor Detail

      • DistributedSession

        protected DistributedSession​(int nothing)
        INTERNAL: Create a blank session, used for proxy session.
      • DistributedSession

        public DistributedSession​(org.eclipse.persistence.internal.sessions.remote.RemoteConnection remoteConnection)
        PUBLIC: Creates a DistributedSession.
        Parameters:
        remoteConnection - remote session requires a remote connection. This must be accessed remotely from the client through RMI or CORBA.
    • Method Detail

      • acquireUnitOfWork

        public abstract org.eclipse.persistence.internal.sessions.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
        Overrides:
        acquireUnitOfWork in class org.eclipse.persistence.internal.sessions.AbstractSession
        See Also:
        UnitOfWorkImpl
      • beginTransaction

        public void beginTransaction()
        PUBLIC: Start a transaction on the server. A unit of work should normally be used instead of transactions for the remote session.
        Specified by:
        beginTransaction in interface DatabaseSession
        Overrides:
        beginTransaction in class org.eclipse.persistence.internal.sessions.AbstractSession
        See Also:
        AbstractSession.isInTransaction()
      • commitTransaction

        public void commitTransaction()
        PUBLIC: Commit a transaction on the server. A unit of work should normally be used instead of transactions for the remote session.
        Specified by:
        commitTransaction in interface DatabaseSession
        Overrides:
        commitTransaction in class org.eclipse.persistence.internal.sessions.AbstractSession
      • cursorSelectObjects

        public org.eclipse.persistence.internal.sessions.remote.RemoteCursoredStream cursorSelectObjects​(CursoredStreamPolicy policy)
        INTERNAL: Return remote cursor stream.
      • cursorSelectObjects

        public org.eclipse.persistence.internal.sessions.remote.RemoteScrollableCursor cursorSelectObjects​(ScrollableCursorPolicy policy)
        INTERNAL: Return remote scrollable cursor
      • 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. The named query can be defined on the remote session or the server-side session.
        Specified by:
        executeQuery in interface Session
        Overrides:
        executeQuery in class org.eclipse.persistence.internal.sessions.AbstractSession
        Throws:
        DatabaseException
        See Also:
        AbstractSession.addQuery(String, DatabaseQuery)
      • executeQuery

        public Object executeQuery​(String queryName,
                                   Vector argumentValues)
                            throws DatabaseException
        PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.
        Overrides:
        executeQuery in class org.eclipse.persistence.internal.sessions.AbstractSession
        Throws:
        DatabaseException
        See Also:
        AbstractSession.addQuery(String, DatabaseQuery)
      • executeQuery

        public abstract Object executeQuery​(DatabaseQuery query)
        Execute the database query.
        Specified by:
        executeQuery in interface Session
        Overrides:
        executeQuery in class org.eclipse.persistence.internal.sessions.AbstractSession
        See Also:
        DatabaseQuery
      • executeQuery

        public Object executeQuery​(DatabaseQuery query,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord row)
        INTERNAL: Execute the database query.
        Overrides:
        executeQuery in class org.eclipse.persistence.internal.sessions.AbstractSession
      • getDefaultReadOnlyClasses

        public Vector getDefaultReadOnlyClasses()
        INTERNAL: CR#2751 Returns the set of read-only classes for the receiver. These class come from the Remote connection
        Overrides:
        getDefaultReadOnlyClasses in class org.eclipse.persistence.internal.sessions.AbstractSession
        Returns:
        A Vector containing the Java Classes that are currently read-only.
        See Also:
        Project.setDefaultReadOnlyClasses(Collection)
      • getDescriptorForAlias

        public ClassDescriptor getDescriptorForAlias​(String alias)
        INTERNAL: Return the table descriptor specified for the class.
        Specified by:
        getDescriptorForAlias in interface Session
        Overrides:
        getDescriptorForAlias in class org.eclipse.persistence.internal.sessions.AbstractSession
        Parameters:
        alias - The descriptor alias.
        Returns:
        The descriptor for the alias or null if no descriptor was found.
      • getObjectCorrespondingTo

        public abstract Object getObjectCorrespondingTo​(Object serverSideDomainObject,
                                                        Map objectDescriptors,
                                                        Map processedObjects,
                                                        ObjectLevelReadQuery query)
        INTERNAL: Return the corresponding objects from the remote session for the objects read from the server.
      • getObjectsCorrespondingToAll

        public abstract Object getObjectsCorrespondingToAll​(Object serverSideDomainObjects,
                                                            Map objectDescriptors,
                                                            Map processedObjects,
                                                            ObjectLevelReadQuery query,
                                                            org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
        INTERNAL: Return the corresponding objects from the remote session for the objects read from the server.
      • getRemoteConnection

        public org.eclipse.persistence.internal.sessions.remote.RemoteConnection getRemoteConnection()
        INTERNAL: Return the remote connection.
      • hasCorrespondingDescriptor

        public boolean hasCorrespondingDescriptor​(ClassDescriptor descriptor)
        INTERNAL: Checks if the descriptor exists or not.
      • initializeIdentityMapAccessor

        public void initializeIdentityMapAccessor()
        INTERNAL: Set up the IdentityMapManager. Overrides the default IdentityMapManager
        Overrides:
        initializeIdentityMapAccessor in class org.eclipse.persistence.internal.sessions.AbstractSession
      • instantiateRemoteValueHolderOnServer

        public abstract Object instantiateRemoteValueHolderOnServer​(org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder remoteValueHolder)
        INTERNAL: This will instantiate value holder on the server.
      • isConnected

        public boolean isConnected()
        PUBLIC: Return if this session is connected to the server.
        Specified by:
        isConnected in interface Session
        Overrides:
        isConnected in class org.eclipse.persistence.internal.sessions.AbstractSession
      • isDistributedSession

        public boolean isDistributedSession()
        INTERNAL: Return if this session is a distributed session.
        Specified by:
        isDistributedSession in interface Session
        Overrides:
        isDistributedSession in class org.eclipse.persistence.internal.sessions.AbstractSession
      • isRemoteSession

        public boolean isRemoteSession()
        INTERNAL: Return if this session is a remote session.
        Specified by:
        isRemoteSession in interface Session
        Overrides:
        isRemoteSession in class org.eclipse.persistence.internal.sessions.AbstractSession
      • privilegedAddDescriptor

        public void privilegedAddDescriptor​(ClassDescriptor descriptor)
        INTERNAL: You cannot add descriptors to a remote session. This is a internal method used by TopLink
      • rollbackTransaction

        public void rollbackTransaction()
        PUBLIC: Rollback a transaction on the server. A unit of work should normally be used instead of transactions for the remote session.
        Specified by:
        rollbackTransaction in interface DatabaseSession
        Overrides:
        rollbackTransaction in class org.eclipse.persistence.internal.sessions.AbstractSession
      • setRemoteConnection

        public void setRemoteConnection​(org.eclipse.persistence.internal.sessions.remote.RemoteConnection remoteConnection)
        INTERNAL: Set the remote connection.
      • toString

        public String toString()
        PUBLIC: Avoid printing the accessor and platform.
        Overrides:
        toString in class org.eclipse.persistence.internal.sessions.AbstractSession
      • logout

        public void logout()
        PUBLIC: Logout the session, close the remote connection and release the hold resources
        Specified by:
        logout in interface DatabaseSession
        Overrides:
        logout in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
      • isMetadataRemote

        public boolean isMetadataRemote()
        ADVANCED: Return if the descriptors and meta-data should be serialized from the server, or if they will be provided locally.
      • setIsMetadataRemote

        public void setIsMetadataRemote​(boolean isMetadataRemote)
        ADVANCED: Set if the descriptors and meta-data should be serialized from the server, or if they will be provided locally.
      • connect

        public void connect()
                     throws DatabaseException
        INTERNAL: Connect not required.
        Overrides:
        connect in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
        Throws:
        DatabaseException
      • disconnect

        public void disconnect()
                        throws DatabaseException
        INTERNAL: Disconnect not required.
        Overrides:
        disconnect in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
        Throws:
        DatabaseException
      • loginAndDetectDatasource

        public void loginAndDetectDatasource()
                                      throws DatabaseException
        PUBLIC: Connect to the database using the predefined login. During connection, attempt to auto detect the required database platform. This method can be used in systems where for ease of use developers have EclipseLink autodetect the platform. To be safe, however, the platform should be configured directly. The login must have been assigned when or after creating the session.
        Overrides:
        loginAndDetectDatasource in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
        Throws:
        DatabaseException
      • login

        public void login()
                   throws DatabaseException
        PUBLIC: Connect to the database using the predefined login. Obtain the login from the server, as it may have configuration initialized from the database meta-data.
        Specified by:
        login in interface DatabaseSession
        Overrides:
        login in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
        Throws:
        DatabaseException
        See Also:
        DatabaseSessionImpl.login(Login)