Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.0.0.Beta5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbpm.shared.services.impl
Class JbpmServicesPersistenceManagerImpl

    java.lang.Object
      org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl

All Implemented Interfaces:
  JbpmServicesPersistenceManager

    public class JbpmServicesPersistenceManagerImpl

extends Object
implements JbpmServicesPersistenceManager

From the Hibernate docs:

     An EntityManager is an inexpensive, non-threadsafe object that
     should be used once, for a single business process, a single unit
     of work, and then discarded. An EntityManager will not obtain
     a JDBC Connection (or a Datasource) unless it is needed, so
     you may safely open and close an EntityManager even if you are
     not sure that data access will be needed to serve a particular request.

This class is a wrapper around the entity manager that handles all persistence operations. This way, the persistence functionality can be isolated from the human-task server functionality. This class is only mean to be used in one thread: with every request handled by the human-task server, a TaskServiceSession is created with an instance of this class. Once the request has been handled, the TaskServiceSession instance and the TaskPersistenceManager instance are disposed of.

Field Summary
`static String` | `FIRST_RESULT`
`static String` | `MAX_RESULTS`

Constructor Summary
`JbpmServicesPersistenceManagerImpl()`

Method Summary
`HashMap<String,Object>` | `addParametersToMap(Object... parameterValues)`
`boolean` | `beginTransaction()`
`void` | `dispose()`
`void` | `endPersistenceContext()`
`void` | `endTransaction(boolean txOwner)`
`int` | `executeUpdateString(String updateString)`
`
`<T> T`
` | `find(Class<T> entityClass, Object primaryKey)`
`javax.persistence.EntityManager` | `getEm()`
`javax.persistence.EntityManagerFactory` | `getEmf()`
`boolean` | `hasTransactionManager()`
`boolean` | `isSharedEntityManager()`
`
`<T> T`
` | `merge(T entity)`
`void` | `persist(Object entity)`
`Object` | `queryInTransaction(String queryName)`
`Object` | `queryStringInTransaction(String queryString)`
`Object` | `queryStringWithParametersInTransaction(String queryString, Map<String,Object> params)`
`Object` | `queryWithParametersInTransaction(String queryName, Map<String,Object> params)` It is strongly suggested that you only use this method within a transaction!!
`Object` | `queryWithParametersInTransaction(String queryName, Map<String,Object> params, boolean singleResult)` This method runs a query within a transaction and returns the result.
`void` | `remove(Object entity)`
`void` | `rollBackTransaction(boolean txOwner)`
`void` | `setEm(javax.persistence.EntityManager em)`
`void` | `setTransactionManager(JbpmServicesTransactionManager ttxm)`
`void` | `setUseSharedEntityManager(boolean sharedEntityManager)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FIRST_RESULT

    public static final String FIRST_RESULT

See Also:
  Constant Field Values

### MAX_RESULTS

    public static final String MAX_RESULTS

See Also:
  Constant Field Values

Constructor Detail

### JbpmServicesPersistenceManagerImpl

    public JbpmServicesPersistenceManagerImpl()

Method Detail

### getEmf

    public javax.persistence.EntityManagerFactory getEmf()

### setUseSharedEntityManager

    public void setUseSharedEntityManager(boolean sharedEntityManager)

### isSharedEntityManager

    public boolean isSharedEntityManager()

### setEm

    public void setEm(javax.persistence.EntityManager em)

### setTransactionManager

    public void setTransactionManager(JbpmServicesTransactionManager ttxm)

### hasTransactionManager

    public boolean hasTransactionManager()

### executeUpdateString

    public int executeUpdateString(String updateString)

  Specified by:
    `executeUpdateString` in interface `JbpmServicesPersistenceManager`

### find

    public <T> T find(Class<T> entityClass,
                      Object primaryKey)

  Specified by:
    `find` in interface `JbpmServicesPersistenceManager`

### remove

    public void remove(Object entity)

  Specified by:
    `remove` in interface `JbpmServicesPersistenceManager`

### persist

    public void persist(Object entity)

  Specified by:
    `persist` in interface `JbpmServicesPersistenceManager`

### merge

    public <T> T merge(T entity)

  Specified by:
    `merge` in interface `JbpmServicesPersistenceManager`

### queryStringWithParametersInTransaction

    public Object queryStringWithParametersInTransaction(String queryString,
                                                         Map<String,Object> params)

  Specified by:
    `queryStringWithParametersInTransaction` in interface `JbpmServicesPersistenceManager`

### queryStringInTransaction

    public Object queryStringInTransaction(String queryString)

  Specified by:
    `queryStringInTransaction` in interface `JbpmServicesPersistenceManager`

### beginTransaction

    public boolean beginTransaction()

### endTransaction

    public void endTransaction(boolean txOwner)

### rollBackTransaction

    public void rollBackTransaction(boolean txOwner)

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `JbpmServicesPersistenceManager`

### endPersistenceContext

    public void endPersistenceContext()

### getEm

    public javax.persistence.EntityManager getEm()

### queryWithParametersInTransaction

    public Object queryWithParametersInTransaction(String queryName,
                                                   Map<String,Object> params,
                                                   boolean singleResult)

  This method runs a query within a transaction and returns the result. This logic is unfortunately duplicated in `TaskServiceSession#doOperationInTransaction`. If you change the logic here, please make sure to change the logic there as well (and vice versa).

  Parameters:
    `queryName` -
    `params` -
  Returns:

### queryWithParametersInTransaction

    public Object queryWithParametersInTransaction(String queryName,
                                                   Map<String,Object> params)

  Description copied from interface: `JbpmServicesPersistenceManager`
  It is strongly suggested that you only use this method within a transaction!! PostgreSQL and DB2 are 2 databases which, depending on your situation, will probably require this.

  Specified by:
    `queryWithParametersInTransaction` in interface `JbpmServicesPersistenceManager`
  Returns:
    The result of the query.

### queryInTransaction

    public Object queryInTransaction(String queryName)

  Specified by:
    `queryInTransaction` in interface `JbpmServicesPersistenceManager`

### addParametersToMap

    public HashMap<String,Object> addParametersToMap(Object... parameterValues)

  Specified by:
    `addParametersToMap` in interface `JbpmServicesPersistenceManager`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.0.0.Beta5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.