org.camunda.bpm.cycle.repository
Class AbstractRepository<T extends AbstractEntity>

java.lang.Object
  extended by org.camunda.bpm.cycle.repository.AbstractRepository<T>
Direct Known Subclasses:
BpmnDiagramRepository, ConnectorConfigurationRepository, ConnectorCredentialsRepository, RoundtripRepository, UserRepository

public class AbstractRepository<T extends AbstractEntity>
extends Object

Abstract repository which holds the base information

Author:
nico.rehwaldt

Field Summary
protected  javax.persistence.EntityManager em
           
 
Constructor Summary
protected AbstractRepository()
           
 
Method Summary
 long countAll()
          Returns the number of all entities in the database
 void delete(Long id)
          Delete a given entity by id
 void delete(T entity)
          Delete a given entity from
 int deleteAll()
          Delete all entities BEWARE: It doesn't trigger cascade or removeOrphan functionality for the deleted entites, because it is an JQL statement, not an @{link EntityManager} method.
 List<T> findAll()
          Find all entities
 T findById(long id)
          Find a given entity by id
 T saveAndFlush(T entity)
          Save the given entity and flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

em

protected javax.persistence.EntityManager em
Constructor Detail

AbstractRepository

protected AbstractRepository()
Method Detail

saveAndFlush

@Transactional
public T saveAndFlush(T entity)
Save the given entity and flush

Returns:

delete

@Transactional
public void delete(Long id)
Delete a given entity by id


delete

@Transactional
public void delete(T entity)
Delete a given entity from


findById

public T findById(long id)
Find a given entity by id

Returns:
the element or null if the element was not found

findAll

public List<T> findAll()
Find all entities

Returns:

countAll

public long countAll()
Returns the number of all entities in the database

Returns:

deleteAll

@Transactional
public int deleteAll()
Delete all entities BEWARE: It doesn't trigger cascade or removeOrphan functionality for the deleted entites, because it is an JQL statement, not an @{link EntityManager} method.

Returns:


Copyright © 2014 camunda services GmbH. All rights reserved.