FileDocCategorySizeDatePackage
IsolatedClientSession.javaAPI DocGlassfish v2 API6779Tue May 22 16:54:44 BST 2007oracle.toplink.essentials.internal.sessions

IsolatedClientSession

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.

Fields Summary
Constructors Summary
public IsolatedClientSession(ServerSession parent, ConnectionPolicy connectionPolicy)

        super(parent, connectionPolicy);
    
Methods Summary
public java.lang.ObjectexecuteCall(oracle.toplink.essentials.queryframework.Call call, oracle.toplink.essentials.internal.sessions.AbstractRecord translationRow, oracle.toplink.essentials.queryframework.DatabaseQuery query)
INTERNAL: Isolated sessions must forward call execution to its parent, unless in a transaction. This is required as isolated sessions are always the execution session for isolated classes.

        if (isInTransaction()) {
            return super.executeCall(call, translationRow, query);
        }
        return getParent().executeCall(call, translationRow, query);
    
public oracle.toplink.essentials.internal.sessions.AbstractSessiongetExecutionSession(oracle.toplink.essentials.queryframework.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.

return
a session with a live accessor
param
query may store session name or reference class for brokers case

        if (shouldExecuteLocally(query)) {
            return this;
        } else {
            return getParent().getExecutionSession(query);
        }
    
public oracle.toplink.essentials.internal.sessions.AbstractSessiongetParentIdentityMapSession(oracle.toplink.essentials.queryframework.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.

param
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.
param
terminalOnly return the session we will execute the call on, not the next step towards it.
return
this if there is no next link in the chain

        if ((query != null) && isIsolatedQuery(query)) {
            return this;
        } else {
            return getParent().getParentIdentityMapSession(query, canReturnSelf, terminalOnly);
        }
    
public voidinitializeIdentityMapAccessor()
INTERNAL: Set up the IdentityMapManager. This method allows subclasses of Session to override the default IdentityMapManager functionality.

        this.identityMapAccessor = new IsolatedClientSessionIdentityMapAccessor(this, new IdentityMapManager(this));
    
protected booleanisIsolatedQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)
INTERNAL: Answers if this query is an isolated query and must be executed locally.

        query.checkDescriptor(this);
        if (query.isDataModifyQuery() || ((query.getDescriptor() != null) && query.getDescriptor().isIsolated())) {
            // For CR#4334 if in transaction stay on client session.
            // That way client's write accessor will be used for all queries.
            // This is to preserve transaction isolation levels.
            // also if this is an isolated class and we are in an isolated session
            //load locally. 
            return true;
        }
        return false;

    
protected booleanshouldExecuteLocally(oracle.toplink.essentials.queryframework.DatabaseQuery query)
INTERNAL: Helper method to calculate whether to execute this query locally or send it to the server session.

        if (isIsolatedQuery(query)) {
            return true;
        }
        return isInTransaction();