|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectse.vgregion.dao.domain.patterns.repository.db.jpa.AbstractJpaRepository<T,ID,PK>
T - The Entity TypeID - The ID of the EntityPK - The type of the primary keypublic abstract class AbstractJpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>
An abstract default implementation of a DatabaseRepository. This is an JPA implementation used with any
JPA implementation such as Hibernate.
| Field Summary | |
|---|---|
protected javax.persistence.EntityManager |
entityManager
Entity manager ref. |
protected Class<T> |
type
Entity class type. |
| Constructor Summary | |
|---|---|
AbstractJpaRepository()
Default constructor. |
|
AbstractJpaRepository(Class<T> type)
Parameterized constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
Clear the persistence context, causing all managed entities to become detached. |
boolean |
contains(T entity)
Does entity manager contain entity? |
T |
find(ID id)
|
List<T> |
findAll()
|
List<T> |
findByNamedQuery(String queryName,
Map<String,? extends Object> args)
Find instances of T that match the criteria defined by query queryName. |
List<T> |
findByNamedQuery(String queryName,
Object[] args)
Find instances of T that match the criteria defined by query queryName. |
T |
findByPrimaryKey(PK pk)
|
T |
findInstanceByNamedQuery(String queryName,
Map<String,? extends Object> args)
Find a single instance of T using the query named queryName and the arguments
identified by args. |
T |
findInstanceByNamedQuery(String queryName,
Object[] args)
Find a single instance of T using the query named queryName and the arguments
identified by args. |
void |
flush()
|
T |
merge(T entity)
|
T |
persist(T entity)
|
void |
refresh(T entity)
|
void |
remove(ID id)
|
void |
remove(T entity)
|
void |
removeByPrimaryKey(PK pk)
|
void |
setType(Class<T> type)
|
T |
store(T entity)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.persistence.EntityManager entityManager
protected Class<T extends Entity<T,ID>> type
| Constructor Detail |
|---|
public AbstractJpaRepository()
public AbstractJpaRepository(Class<T> type)
type - Entity class type| Method Detail |
|---|
public void setType(Class<T> type)
@Transactional(propagation=SUPPORTS,
readOnly=true)
public boolean contains(T entity)
contains in interface Repository<T extends Entity<T,ID>,ID extends Serializable>entity - Entity to check for
@Transactional(propagation=SUPPORTS,
readOnly=true)
public List<T> findAll()
findAll in interface Repository<T extends Entity<T,ID>,ID extends Serializable>
@Transactional(propagation=SUPPORTS,
readOnly=true)
public List<T> findByNamedQuery(String queryName,
Map<String,? extends Object> args)
T that match the criteria defined by query queryName.
args provide the values for any named parameters in the query identified by
queryName.
findByNamedQuery in interface JpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>queryName - the named query to executeargs - the values used by the query
T objects
@Transactional(propagation=SUPPORTS,
readOnly=true)
public List<T> findByNamedQuery(String queryName,
Object[] args)
T that match the criteria defined by query queryName.
args provide values for positional arguments in the query identified by queryName.
findByNamedQuery in interface JpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>queryName - the named query to executeargs - the positional values used in the query
T objects
@Transactional(propagation=SUPPORTS,
readOnly=true)
public T findInstanceByNamedQuery(String queryName,
Object[] args)
T using the query named queryName and the arguments
identified by args.
findInstanceByNamedQuery in interface JpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>queryName - the name of the query to useargs - the arguments for the named query
@Transactional(propagation=SUPPORTS,
readOnly=true)
public T findInstanceByNamedQuery(String queryName,
Map<String,? extends Object> args)
T using the query named queryName and the arguments
identified by args.
findInstanceByNamedQuery in interface JpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>queryName - the name of the query to useargs - a Map holding the named parameters of the query
@Transactional(propagation=SUPPORTS,
readOnly=true)
public T find(ID id)
find in interface Repository<T extends Entity<T,ID>,ID extends Serializable>
@Transactional(propagation=SUPPORTS,
readOnly=true)
public T findByPrimaryKey(PK pk)
findByPrimaryKey in interface DatabaseRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>@Transactional(propagation=MANDATORY) public void flush()
flush in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public T persist(T entity)
persist in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.
@Transactional(propagation=SUPPORTS,
readOnly=true)
public void clear()
clear in interface JpaRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public void remove(T entity)
remove in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public void remove(ID id)
remove in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public void removeByPrimaryKey(PK pk)
removeByPrimaryKey in interface DatabaseRepository<T extends Entity<T,ID>,ID extends Serializable,PK extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public T merge(T entity)
merge in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.@Transactional(propagation=MANDATORY) public T store(T entity)
store in interface Repository<T extends Entity<T,ID>,ID extends Serializable>{@link - IllegalTransactionStateException} if the method is invoked without an existing transaction.
@Transactional(propagation=SUPPORTS,
readOnly=true)
public void refresh(T entity)
refresh in interface Repository<T extends Entity<T,ID>,ID extends Serializable>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||