Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.0.0-SNAPSHOT
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)` Find method is explicitly left without managing transaction to avoid huge overhead it introduces with heavy load and it only attaches to persistence context to be part of transaction that is managed outside.
`javax.persistence.EntityManager` | `getEm()`
`javax.persistence.EntityManagerFactory` | `getEmf()`
`protected javax.persistence.EntityManager` | `getLocalEntityManager()`
`boolean` | `hasTransactionManager()`
`boolean` | `isSharedEntityManager()`
`
`<T> T`
` | `merge(T entity)`
`void` | `persist(Object entity)`
`Object` | `queryAndLockStringWithParametersInTransaction(String queryString, Map<String,Object> params, boolean singleResult)`
`Object` | `queryAndLockWithParametersInTransaction(String queryName, Map<String,Object> params, boolean singleResult)`
`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` | `setEmf(javax.persistence.EntityManagerFactory emf)`
`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)

### setEmf

    public void setEmf(javax.persistence.EntityManagerFactory emf)

### 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)

  Find method is explicitly left without managing transaction to avoid huge overhead it introduces with heavy load and it only attaches to persistence context to be part of transaction that is managed outside.

  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`

### queryAndLockStringWithParametersInTransaction

    public Object queryAndLockStringWithParametersInTransaction(String queryString,
                                                                Map<String,Object> params,
                                                                boolean singleResult)

  Specified by:
    `queryAndLockStringWithParametersInTransaction` 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()

  Specified by:
    `beginTransaction` in interface `JbpmServicesPersistenceManager`

### endTransaction

    public void endTransaction(boolean txOwner)

  Specified by:
    `endTransaction` in interface `JbpmServicesPersistenceManager`

### rollBackTransaction

    public void rollBackTransaction(boolean txOwner)

  Specified by:
    `rollBackTransaction` in interface `JbpmServicesPersistenceManager`

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `JbpmServicesPersistenceManager`

### endPersistenceContext

    public void endPersistenceContext()

### getEm

    public javax.persistence.EntityManager getEm()

### getLocalEntityManager

    protected javax.persistence.EntityManager getLocalEntityManager()

### 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:

### queryAndLockWithParametersInTransaction

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

  Specified by:
    `queryAndLockWithParametersInTransaction` in interface `JbpmServicesPersistenceManager`

### 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-SNAPSHOT
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.