org.jbpm.persistence.db
Class DbPersistenceService

java.lang.Object
  extended by org.jbpm.persistence.db.DbPersistenceService
All Implemented Interfaces:
java.io.Serializable, PersistenceService, Service
Direct Known Subclasses:
JtaDbPersistenceService

public class DbPersistenceService
extends java.lang.Object
implements Service, PersistenceService

See Also:
Serialized Form

Field Summary
protected  java.sql.Connection connection
           
protected  ContextSession contextSession
           
protected  GraphSession graphSession
           
protected  boolean isCurrentSessionEnabled
           
protected  boolean isTransactionEnabled
           
protected  JobSession jobSession
           
protected  LoggingSession loggingSession
           
protected  boolean mustConnectionBeClosed
           
protected  boolean mustSessionBeClosed
           
protected  boolean mustSessionBeFlushed
           
protected  DbPersistenceServiceFactory persistenceServiceFactory
           
protected  Services services
          Deprecated. for access to other services, invoke JbpmContext.getServices()
protected  org.hibernate.Session session
           
protected  TaskMgmtSession taskMgmtSession
           
protected  org.hibernate.Transaction transaction
           
 
Constructor Summary
DbPersistenceService(DbPersistenceServiceFactory persistenceServiceFactory)
           
 
Method Summary
 void assignId(java.lang.Object object)
           
 void beginTransaction()
           
 void close()
           
protected  java.lang.Exception commit()
           
 void endTransaction()
           
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(boolean resolveSession)
           
 ContextSession getContextSession()
           
 javax.sql.DataSource getDataSource()
           
 GraphSession getGraphSession()
           
 JobSession getJobSession()
           
 LoggingSession getLoggingSession()
           
 org.hibernate.Session getSession()
           
 org.hibernate.SessionFactory getSessionFactory()
           
 TaskMgmtSession getTaskMgmtSession()
           
 org.hibernate.Transaction getTransaction()
           
static boolean isLockingException(java.lang.Exception exception)
           
static boolean isPersistenceException(java.lang.Exception exception)
           
 boolean isRollbackOnly()
          Deprecated. use TxService.isRollbackOnly() instead
 boolean isTransactionActive()
           
 boolean isTransactionEnabled()
           
protected  boolean isTransactionManagedExternally()
           
protected  boolean isTransactionRollbackOnly()
           
protected  java.lang.Exception rollback()
           
 void setConnection(java.sql.Connection connection)
           
 void setContextSession(ContextSession contextSession)
           
 void setDataSource(javax.sql.DataSource dataSource)
           
 void setGraphSession(GraphSession graphSession)
           
 void setJobSession(JobSession jobSession)
           
 void setLoggingSession(LoggingSession loggingSession)
           
 void setRollbackOnly()
          Deprecated. use TxService.setRollbackOnly() instead
 void setRollbackOnly(boolean rollbackOnly)
          Deprecated. use TxService.setRollbackOnly() instead
 void setSession(org.hibernate.Session session)
          Injects an external Hibernate session, disabling transaction management.
 void setSession(org.hibernate.Session session, boolean keepTransactionEnabled)
          Injects an external Hibernate session.
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
           
 void setSessionWithoutDisablingTx(org.hibernate.Session session)
          Deprecated. use setSession(session, true) instead
 void setTaskMgmtSession(TaskMgmtSession taskMgmtSession)
           
 void setTransaction(org.hibernate.Transaction transaction)
           
 void setTransactionEnabled(boolean isTransactionEnabled)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persistenceServiceFactory

protected final DbPersistenceServiceFactory persistenceServiceFactory

connection

protected java.sql.Connection connection

mustConnectionBeClosed

protected boolean mustConnectionBeClosed

transaction

protected org.hibernate.Transaction transaction

isTransactionEnabled

protected boolean isTransactionEnabled

isCurrentSessionEnabled

protected boolean isCurrentSessionEnabled

session

protected org.hibernate.Session session

mustSessionBeFlushed

protected boolean mustSessionBeFlushed

mustSessionBeClosed

protected boolean mustSessionBeClosed

graphSession

protected GraphSession graphSession

taskMgmtSession

protected TaskMgmtSession taskMgmtSession

jobSession

protected JobSession jobSession

contextSession

protected ContextSession contextSession

loggingSession

protected LoggingSession loggingSession

services

protected Services services
Deprecated. for access to other services, invoke JbpmContext.getServices()
Constructor Detail

DbPersistenceService

public DbPersistenceService(DbPersistenceServiceFactory persistenceServiceFactory)
Method Detail

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()

getSession

public org.hibernate.Session getSession()

beginTransaction

public void beginTransaction()

endTransaction

public void endTransaction()

getConnection

public java.sql.Connection getConnection()

getConnection

public java.sql.Connection getConnection(boolean resolveSession)

isTransactionActive

public boolean isTransactionActive()

isTransactionManagedExternally

protected boolean isTransactionManagedExternally()

isTransactionRollbackOnly

protected boolean isTransactionRollbackOnly()

close

public void close()
Specified by:
close in interface Service

commit

protected java.lang.Exception commit()

rollback

protected java.lang.Exception rollback()

assignId

public void assignId(java.lang.Object object)
Specified by:
assignId in interface PersistenceService

getGraphSession

public GraphSession getGraphSession()
Specified by:
getGraphSession in interface PersistenceService

getLoggingSession

public LoggingSession getLoggingSession()
Specified by:
getLoggingSession in interface PersistenceService

getJobSession

public JobSession getJobSession()
Specified by:
getJobSession in interface PersistenceService

getContextSession

public ContextSession getContextSession()
Specified by:
getContextSession in interface PersistenceService

getTaskMgmtSession

public TaskMgmtSession getTaskMgmtSession()
Specified by:
getTaskMgmtSession in interface PersistenceService

getDataSource

public javax.sql.DataSource getDataSource()

isRollbackOnly

public boolean isRollbackOnly()
Deprecated. use TxService.isRollbackOnly() instead

Specified by:
isRollbackOnly in interface PersistenceService

setRollbackOnly

public void setRollbackOnly()
Deprecated. use TxService.setRollbackOnly() instead

Specified by:
setRollbackOnly in interface PersistenceService

setRollbackOnly

public void setRollbackOnly(boolean rollbackOnly)
Deprecated. use TxService.setRollbackOnly() instead

Specified by:
setRollbackOnly in interface PersistenceService
Throws:
java.lang.UnsupportedOperationException - if rollbackOnly is false

setSession

public void setSession(org.hibernate.Session session)
Injects an external Hibernate session, disabling transaction management.


setSessionWithoutDisablingTx

public void setSessionWithoutDisablingTx(org.hibernate.Session session)
Deprecated. use setSession(session, true) instead

Injects an external Hibernate session without affecting transaction management.


setSession

public void setSession(org.hibernate.Session session,
                       boolean keepTransactionEnabled)
Injects an external Hibernate session. Injecting a session would normally disable transaction management. The keepTransactionEnabled parameter can be used to prevent transaction management from being disabled, according to the following table.
is currently enabled? keep enabled? enabled onward
true true true (no change)
true false false
false n/a false (no change)


setConnection

public void setConnection(java.sql.Connection connection)

setContextSession

public void setContextSession(ContextSession contextSession)

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)

setGraphSession

public void setGraphSession(GraphSession graphSession)
Specified by:
setGraphSession in interface PersistenceService

setLoggingSession

public void setLoggingSession(LoggingSession loggingSession)
Specified by:
setLoggingSession in interface PersistenceService

setJobSession

public void setJobSession(JobSession jobSession)
Specified by:
setJobSession in interface PersistenceService

setTaskMgmtSession

public void setTaskMgmtSession(TaskMgmtSession taskMgmtSession)
Specified by:
setTaskMgmtSession in interface PersistenceService

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)

getTransaction

public org.hibernate.Transaction getTransaction()

setTransaction

public void setTransaction(org.hibernate.Transaction transaction)

isTransactionEnabled

public boolean isTransactionEnabled()

setTransactionEnabled

public void setTransactionEnabled(boolean isTransactionEnabled)

isPersistenceException

public static boolean isPersistenceException(java.lang.Exception exception)

isLockingException

public static boolean isLockingException(java.lang.Exception exception)


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.