public abstract class JPABaseDao<T,K> extends Object implements GenericBaseDao<T,K>
| Modifier and Type | Field and Description |
|---|---|
protected javax.persistence.EntityManager |
entityManager |
| Constructor and Description |
|---|
JPABaseDao() |
| Modifier and Type | Method and Description |
|---|---|
void |
create(T entity) |
protected org.hibernate.Query |
createHibernateQuery(String hql) |
protected javax.persistence.TypedQuery<T> |
createQuery(String jpql) |
protected <O> javax.persistence.TypedQuery<O> |
createQuery(String jpql,
Class<O> type) |
protected javax.persistence.Query |
createUntypedQuery(String jpql) |
void |
delete(T entity) |
T |
find(K id) |
void |
flushAndClear()
Write pending objects to the database and
clear session-scoped cache
|
protected T |
getSingleResultForQuery(javax.persistence.TypedQuery<T> query) |
abstract Class<T> |
getType() |
void |
lock(T entity)
Pessimistic write lock on entity
|
void |
setEntityManager(javax.persistence.EntityManager entityManager)
Hook to manually inject an EntityManager.
|
void |
update(T entity) |
public void setEntityManager(javax.persistence.EntityManager entityManager)
entityManager - the EntityManager for this DAO classprotected javax.persistence.Query createUntypedQuery(String jpql)
protected org.hibernate.Query createHibernateQuery(String hql)
public void create(T entity)
create in interface GenericBaseDao<T,K>public void update(T entity)
update in interface GenericBaseDao<T,K>public void lock(T entity)
lock in interface GenericBaseDao<T,K>public void delete(T entity)
delete in interface GenericBaseDao<T,K>public void flushAndClear()
flushAndClear in interface GenericBaseDao<T,K>Copyright © 2018 JBoss by Red Hat. All rights reserved.