org.springframework.orm.toplink
Class ServerSessionFactory

java.lang.Object
  extended by org.springframework.orm.toplink.ServerSessionFactory
All Implemented Interfaces:
SessionFactory

public class ServerSessionFactory
extends Object
implements SessionFactory

Full-fledged default implementation of the SessionFactory interface: creates ClientSessions for a given ServerSession.

Can create a special ClientSession subclass for managed Sessions, carrying an active UnitOfWork that expects to be committed at transaction completion (just like a plain TopLink Session does within a JTA transaction).

Can also create a transaction-aware Session reference that returns the active transactional Session on getActiveSession.

Since:
1.2
Author:
Juergen Hoeller
See Also:
SingleSessionFactory, Session.getActiveUnitOfWork(), Session.getActiveSession()

Constructor Summary
ServerSessionFactory(oracle.toplink.threetier.ServerSession serverSession)
          Create a new ServerSessionFactory for the given ServerSession.
 
Method Summary
 void close()
          Shut the pre-configured TopLink ServerSession down.
 oracle.toplink.sessions.Session createManagedClientSession()
          Create a managed ClientSession for this factory's ServerSession.
 oracle.toplink.sessions.Session createSession()
          Create a plain ClientSession for this factory's ServerSession.
 oracle.toplink.sessions.Session createTransactionAwareSession()
          Create a transaction-aware Session refeence for this factory's ServerSession, expecting transactions to be registered for this SessionFactory.
 oracle.toplink.sessions.Session createTransactionAwareSession(SessionFactory sessionFactory)
          Create a transaction-aware Session refeence for this factory's ServerSession, expecting transactions to be registered for the given SessionFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSessionFactory

public ServerSessionFactory(oracle.toplink.threetier.ServerSession serverSession)
Create a new ServerSessionFactory for the given ServerSession.

Parameters:
serverSession - the TopLink ServerSession to create ClientSessions for
Method Detail

createSession

public oracle.toplink.sessions.Session createSession()
Create a plain ClientSession for this factory's ServerSession.

Specified by:
createSession in interface SessionFactory
Returns:
the new TopLink Session
See Also:
ServerSession.acquireClientSession()

createManagedClientSession

public oracle.toplink.sessions.Session createManagedClientSession()
Create a managed ClientSession for this factory's ServerSession.

Specified by:
createManagedClientSession in interface SessionFactory
Returns:
the new TopLink Session
See Also:
ClientSession

createTransactionAwareSession

public oracle.toplink.sessions.Session createTransactionAwareSession()
                                                              throws oracle.toplink.exceptions.TopLinkException
Create a transaction-aware Session refeence for this factory's ServerSession, expecting transactions to be registered for this SessionFactory.

Specified by:
createTransactionAwareSession in interface SessionFactory
Returns:
the new TopLink Session
Throws:
oracle.toplink.exceptions.TopLinkException - in case of errors
See Also:
Session.getActiveSession(), Session.getActiveUnitOfWork()

createTransactionAwareSession

public oracle.toplink.sessions.Session createTransactionAwareSession(SessionFactory sessionFactory)
                                                              throws oracle.toplink.exceptions.TopLinkException
Create a transaction-aware Session refeence for this factory's ServerSession, expecting transactions to be registered for the given SessionFactory.

This method is public to allow custom SessionFactory facades to access it directly, if necessary.

Parameters:
sessionFactory - the SessionFactory that transactions are expected to be registered for
Throws:
oracle.toplink.exceptions.TopLinkException
See Also:
Session.getActiveSession(), Session.getActiveUnitOfWork()

close

public void close()
Shut the pre-configured TopLink ServerSession down.

Specified by:
close in interface SessionFactory
See Also:
DatabaseSession.logout(), Session.release()


Copyright (c) 2002-2005 The Spring Framework Project.