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
|
T |
merge(T unmanagedEntity,
Class<? extends T> entityClass)
Merges the state of the given unmanaged entity.
|
void |
save(T t)
Saves the given entity.
|
<E extends T> |
saveAll(Collection<E> entities)
Save all entities in the collection to the database
|
getCacheAwareHibernateTemplatepublic void save(@NotNull
T t)
BambooObjectDaoEntityObject 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)
BambooObjectDaosaveAll in interface BambooObjectDao<T extends BambooObject>entities - entities to be saved to database@NotNull public T merge(@NotNull T unmanagedEntity, @NotNull Class<? extends T> entityClass)
BambooObjectDaoThis method should only be used with entities which are not currently managed by Hibernate, otherwise BambooObjectDao.save(BambooObject) should be called.
If the entity implementation is an interface of EntityObject, the EntityObject.getCreationDate() and EntityObject.getLastModificationDate() properties will be updated
accordingly (the former only if a new database object is created).
merge in interface BambooObjectDao<T extends BambooObject>unmanagedEntity - entity not managed by Hibernate to mergeentityClass - class of the entitypublic void delete(@NotNull
T t)
BambooObjectDaodelete in interface BambooObjectDao<T extends BambooObject>t - entity to be removedpublic <E extends T> void deleteAll(@NotNull Collection<E> entities)
BambooObjectDaodeleteAll 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)
BambooObjectDaoClassfindAll in interface BambooObjectDao<T extends BambooObject>aClass - class of entitypublic <E extends T> long countAll(@NotNull Class<E> aClass)
BambooObjectDaocountAll in interface BambooObjectDao<T extends BambooObject>public <E extends T> long countWithRestriction(@NotNull Class<E> aClass, @NotNull org.hibernate.criterion.Criterion restriction)
BambooObjectDaocountWithRestriction in interface BambooObjectDao<T extends BambooObject>@Nullable public <E extends T> E findById(long id, @NotNull Class<E> aClass)
BambooObjectDaofindById 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 © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.