|
Oracle TopLink API Reference 10g Release 3 (10.1.3) B13698-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.toplink.util.SessionFactory
Factory class to simplify the development and generation of code that accesses a TopLink Session and UnitOfWork. This class supports creating a Session or UnitOfWork for the following 2-tier and 3-tier Session usage models: -> DatabaseSession -> Server/ClientSession -> SessionBroker -> Server/ClientSessionBroker -> JTA TX Session This factory class is useful in a stateless system such as a SessionBean where transactional resources (namely the Session and UnitOfWork) do not need to be maintained by the factory. The Session accessed in the class must be defined and configured in a sessions configuration xml.
| Constructor Summary | |
SessionFactory(java.lang.String sessionName)Constructor for creating a new TopLinkSessionHelper instance. |
|
SessionFactory(java.lang.String sessionsXMLPath, java.lang.String sessionName)Constructor for creating a new TopLinkSessionHelper instance. |
|
| Method Summary | |
Session |
acquireSession()Returns the Session active for this specified helper. |
UnitOfWork |
acquireUnitOfWork()Looks up the active UnitOfWork using either the global JTA TX or acquires a new one from the active session. |
UnitOfWork |
acquireUnitOfWork(Session session)Looks up the active UnitOfWork using either the global JTA TX or acquires a new one from the active session. |
java.util.Collection |
detach(java.util.Collection entities)Build a detached copy using a one-off UnitOfWork. |
java.lang.Object |
detach(java.lang.Object entity)Build a detached copy using a one-off UnitOfWork. |
java.lang.String |
getSessionName()Returns the name of the Session used by this factory. |
java.lang.String |
getSessionXMLPath()Returns the path of the sessions configuration xml used by this factory. |
Session |
getSharedSession()Helper method that looks up the session and ensure that if the application has been hot-deployed it gets a fresh version of the Session. |
Session |
getSharedSession(boolean login, boolean refresh)Helper method that looks up the session and ensure that if the application has been hot-deployed it gets a fresh version of the Session. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SessionFactory(java.lang.String sessionsXMLPath,
java.lang.String sessionName)
sessionsXMLPath - - resource path of the sessions configuration xml.sessionName - - name of the session to use.public SessionFactory(java.lang.String sessionName)
sessionName - - name of the session to use.| Method Detail |
public java.lang.String getSessionName()
public java.lang.String getSessionXMLPath()
public Session getSharedSession()
public Session getSharedSession(boolean login,
boolean refresh)
login - - Indicates whether the Session should be logged in.refresh - - Causes the SessionManager to create a new Session.public Session acquireSession()
public UnitOfWork acquireUnitOfWork()
public UnitOfWork acquireUnitOfWork(Session session)
public java.lang.Object detach(java.lang.Object entity)
entity - an existing persistent entitypublic java.util.Collection detach(java.util.Collection entities)
entities - - Collection of entities to create detached copies from.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||