public abstract class BambooHibernateObjectDao<T extends BambooObject> extends StatelessSessionHibernateDaoSupport implements BambooObjectDao<T>
Constructor and Description |
---|
BambooHibernateObjectDao() |
Modifier and Type | Method and Description |
---|---|
<E extends T> |
countAll(Class<E> aClass)
Finds the count of all entities that implement the given Class
|
<E extends T> |
countWithRestriction(Class<E> aClass,
org.hibernate.criterion.Criterion restriction)
Finds the count of all entities that implement the given class and satisfy the provided restriction
|
void |
delete(T t)
Removes the given entity from the database
|
<E extends T> |
deleteAll(Collection<E> entities)
Remove all elements in the collection from database
|
long |
executeCountQuery(String queryName)
Execute count-type query and returns result
|
<E extends T> |
findAll(Class<E> aClass)
Finds all the entities that implement the given
Class |
<E extends T> |
findById(long id,
Class<E> aClass)
Find an entity by its id
|
void |
save(T t)
Saves the given entity.
|
<E extends T> |
saveAll(Collection<E> entities)
Save all entities in the collection to the database
|
getCacheAwareHibernateTemplate
public void save(@NotNull T t)
BambooObjectDao
EntityObject
this method will:
- update EntityObject.getLastModificationDate()
- set EntityObject.getCreationDate()
if the object has not been savedsave
in interface BambooObjectDao<T extends BambooObject>
t
- entity to be savedpublic <E extends T> void saveAll(@NotNull Collection<E> entities)
BambooObjectDao
saveAll
in interface BambooObjectDao<T extends BambooObject>
entities
- entities to be saved to databasepublic void delete(@NotNull T t)
BambooObjectDao
delete
in interface BambooObjectDao<T extends BambooObject>
t
- entity to be removedpublic <E extends T> void deleteAll(@NotNull Collection<E> entities)
BambooObjectDao
deleteAll
in interface BambooObjectDao<T extends BambooObject>
entities
- elements to be removed from database@NotNull public <E extends T> Collection<E> findAll(@NotNull Class<E> aClass)
BambooObjectDao
Class
findAll
in interface BambooObjectDao<T extends BambooObject>
aClass
- class of entitypublic <E extends T> long countAll(@NotNull Class<E> aClass)
BambooObjectDao
countAll
in interface BambooObjectDao<T extends BambooObject>
public <E extends T> long countWithRestriction(@NotNull Class<E> aClass, @NotNull org.hibernate.criterion.Criterion restriction)
BambooObjectDao
countWithRestriction
in interface BambooObjectDao<T extends BambooObject>
@Nullable public <E extends T> E findById(long id, @NotNull Class<E> aClass)
BambooObjectDao
findById
in interface BambooObjectDao<T extends BambooObject>
id
- id of entityaClass
- class of entitypublic long executeCountQuery(@NotNull String queryName)
queryName
- name of the named query to executeCopyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.