org.springframework.dao
exception hierarchy. The central method is execute
, supporting TopLink access code implementing the {@link TopLinkCallback} interface. It provides TopLink Sessionhandling such that neither the TopLinkCallback implementation nor the calling code needs to explicitly care about retrieving/closing TopLink Sessions, or handling Session lifecycle exceptions. For typical single step actions, there are various convenience methods (read, readAll, merge, delete, etc).
Can be used within a service implementation via direct instantiation with a SessionFactory reference, or get prepared in an application context and given to services as bean reference. Note: The SessionFactory should always be configured as bean in the application context, in the first case given to the service directly, in the second case to the prepared template.
This class can be considered as direct alternative to working with the raw TopLink Session API (through SessionFactoryUtils.getSession()
). The major advantage is its automatic conversion to DataAccessExceptions, the major disadvantage that no checked application exceptions can get thrown from within data access code. Corresponding checks and the actual throwing of such exceptions can often be deferred to after callback execution, though.
{@link LocalSessionFactoryBean} is the preferred way of obtaining a referenceto a specific TopLink SessionFactory. It will usually be configured to create ClientSessions for a ServerSession held by it, allowing for seamless multi-threaded execution. The Spring application context will manage its lifecycle, initializing and shutting down the factory as part of the application.
Thanks to Slavik Markovich for implementing the initial TopLink support prototype! @author Juergen Hoeller @author James Clark @since 1.2 @see #setSessionFactory @see TopLinkCallback @see oracle.toplink.sessions.Session @see TopLinkInterceptor @see LocalSessionFactoryBean @see TopLinkTransactionManager @see org.springframework.transaction.jta.JtaTransactionManager
|
|
|
|