public class BaseDAO<T extends BaseEntity,ID extends Serializable> extends SimpleDAO
Modifier and Type | Field and Description |
---|---|
protected Class<T> |
entityClass |
sessionLocator
Modifier and Type | Method and Description |
---|---|
void |
delete(T obj) |
void |
evict(Object o) |
Optional<T> |
find(ID id) |
List<T> |
findByExample(T filter) |
List<T> |
findByExample(T filter,
Integer maxResults) |
List<T> |
findByProperty(String propertyName,
String value) |
List<T> |
findByProperty(String propertyName,
String value,
Integer maxResults) |
List<T> |
findByProperty(String propertyName,
String value,
org.hibernate.criterion.MatchMode matchMode,
Integer maxResults) |
T |
findByUniqueProperty(String propertyName,
Object value) |
T |
findOrException(ID id) |
protected static <K> Optional<K> |
findUniqueResult(Class<K> expectedResultClass,
org.hibernate.Criteria criteria)
Executa o critéria buscando apenas um resultado e garante que o resultado seja da classe especificada.
|
protected static <K> Optional<K> |
findUniqueResult(Class<K> expectedResultClass,
org.hibernate.query.Query query)
Executa a consulta buscando apenas um resultado e garante que o resultado seja da classe especificada.
|
void |
flush() |
Optional<T> |
get(ID id) |
T |
getOrException(ID id) |
List<T> |
listAll() |
T |
merge(T newEntity) |
ID |
save(T newEntity) |
void |
saveOrUpdate(T newEntity) |
getSession, setParametersQuery
protected Class<T extends BaseEntity> entityClass
public void saveOrUpdate(T newEntity)
public void delete(T obj)
public void evict(Object o)
public List<T> findByProperty(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Integer maxResults)
protected static final <K> Optional<K> findUniqueResult(Class<K> expectedResultClass, org.hibernate.Criteria criteria)
protected static final <K> Optional<K> findUniqueResult(Class<K> expectedResultClass, org.hibernate.query.Query query)
public void flush()
Copyright © 2019. All rights reserved.