Class IsolatedClientSession

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

public class IsolatedClientSession extends ClientSession
Provides isolation support by allowing a client session to have a local cache of the subset of the classes. This can be used to avoid caching frequently changing data, or for security or VPD purposes.
See Also:
  • Constructor Details

  • Method Details

    • initializeIdentityMapAccessor

      public void initializeIdentityMapAccessor()
      INTERNAL: Set up the IdentityMapManager. This method allows subclasses of Session to override the default IdentityMapManager functionality.
      Overrides:
      initializeIdentityMapAccessor in class ClientSession
    • shouldExecuteLocally

      protected boolean shouldExecuteLocally(DatabaseQuery query)
      INTERNAL: Helper method to calculate whether to execute this query locally or send it to the server session.
    • isIsolatedQuery

      protected boolean isIsolatedQuery(DatabaseQuery query)
      INTERNAL: Answers if this query is an isolated query and must be executed locally.
    • 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.
      Overrides:
      getParentIdentityMapSession in class ClientSession
      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
    • 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.
      Overrides:
      getCacheKeyFromTargetSessionForMerge in class AbstractSession
    • 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.

      Overrides:
      getExecutionSession in class ClientSession
      Parameters:
      query - may store session name or reference class for brokers case
      Returns:
      a session with a live accessor
    • isIsolatedClientSession

      public boolean isIsolatedClientSession()
      PUBLIC: Return if this session is an isolated client session.
      Overrides:
      isIsolatedClientSession in class AbstractSession
    • isProtectedSession

      public boolean isProtectedSession()
      PUBLIC: Returns true if Protected Entities should be built within this session
      Overrides:
      isProtectedSession in class AbstractSession