org.springframework.orm.toplink
Class SingleSessionFactory

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

public class SingleSessionFactory
extends Object
implements SessionFactory

Simple implementation of the SessionFactory interface: always returns the passed-in Session as-is.

Useful for testing or standalone usage of TopLink-based data access objects. In a server environment, use ServerSessionFactory instead.

Since:
1.2
Author:
Juergen Hoeller
See Also:
ServerSessionFactory

Constructor Summary
SingleSessionFactory(oracle.toplink.sessions.Session session)
          Create a new SingleSessionFactory with the given Session.
 
Method Summary
 void close()
          Shut the pre-configured TopLink Session down.
 oracle.toplink.sessions.Session createManagedClientSession()
          Throws an UnsupportedOperationException: SingleSessionFactory does not support managed client Sessions.
 oracle.toplink.sessions.Session createSession()
          Return the held TopLink Session as-is.
 oracle.toplink.sessions.Session createTransactionAwareSession()
          Throws an UnsupportedOperationException: SingleSessionFactory does not support transaction-aware Sessions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleSessionFactory

public SingleSessionFactory(oracle.toplink.sessions.Session session)
Create a new SingleSessionFactory with the given Session.

Parameters:
session - the TopLink Session to hold
Method Detail

createSession

public oracle.toplink.sessions.Session createSession()
Return the held TopLink Session as-is.

Specified by:
createSession in interface SessionFactory
Returns:
the new TopLink Session
See Also:
SessionFactoryUtils.getSession(SessionFactory, boolean)

createManagedClientSession

public oracle.toplink.sessions.Session createManagedClientSession()
Throws an UnsupportedOperationException: SingleSessionFactory does not support managed client Sessions. Use ServerSessionFactory instead.

Specified by:
createManagedClientSession in interface SessionFactory
Returns:
the new TopLink Session
See Also:
Session.getActiveUnitOfWork()

createTransactionAwareSession

public oracle.toplink.sessions.Session createTransactionAwareSession()
Throws an UnsupportedOperationException: SingleSessionFactory does not support transaction-aware Sessions. Use ServerSessionFactory instead.

Specified by:
createTransactionAwareSession in interface SessionFactory
Returns:
the new TopLink Session
See Also:
Session.getActiveSession(), Session.getActiveUnitOfWork()

close

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

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


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