Class BambooHibernateObjectDao<T extends BambooObject>
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<T>
- All Implemented Interfaces:
BambooObjectDao<T>,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
AgentBuildResultsSummaryHibernateDao,AgentCipherHibernateDao,ArtifactSubscriptionHibernateDao,AuditLogHibernateDao,AuthorHibernateDao,BambooHibernateObjectWithOidDao,BambooHibernateVersionAwareObjectDao,BambooTrustedApplicationsHibernateDao,BranchCommitInformationHibernateDao,BuildNumberExportHibernateDao,BuildResultsSummaryHibernateDao,BuildResultWarningSummaryDaoImpl,CapabilityDaoImpl,CommentHibernateDao,CommitHibernateDao,ConsumedSubscriptionHibernateDao,CrowdDeletedEntityHibernateDao,ElasticTunnelDefinitionDaoImpl,EnvironmentDaoImpl,EnvironmentRepositoryLinkHibernateDao,EphemeralAgentTemplateHibernateDao,HibernateAccessTokenDao,LinkedJiraIssueHibernateDao,LoginInformationHibernateDao,MergeResultSummaryDaoImpl,PerAgentTokenHibernateDao,PlanVcsRevisionHistoryHibernateStandaloneDao,QuickFilterHibernateDao,QuickFilterRuleHibernateDao,QuickSearchItemDaoImpl,RemoteAgentAuthenticationHibernateDao,RepositoryChangesetHibernateDao,ScriptDaoImpl,TestCaseHibernateDao,TestCaseResultHibernateDao,TestResultsHibernateDao,TestsHibernateDao,TrustedKeyHibernateDaoImpl,VariableContextBaselineHibernateDao,VcsBranchHibernateDao,VcsPullRequestHibernateDao,VcsTagDaoImpl,WebhookResponseHibernateDao,WebhookTemplateHibernateDao
public abstract class BambooHibernateObjectDao<T extends BambooObject>
extends StatelessSessionHibernateDaoSupport
implements BambooObjectDao<T>
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconvertSearchTermToLikeExpression(@Nullable String searchTerm) <E extends T>
longFinds the count of all entities that implement the given Class<E extends T>
longcountWithRestriction(@NotNull Class<E> aClass, @NotNull org.hibernate.criterion.Criterion restriction) Finds the count of all entities that implement the given class and satisfy the provided restrictionvoidRemoves the given entity from the database<E extends T>
voiddeleteAll(@NotNull Collection<E> entities) Remove all elements in the collection from databaselongexecuteCountQuery(@NotNull String queryName) Execute count-type query and returns result<E extends T>
@NotNull Collection<E>Finds all the entities that implement the givenClass<E extends T>
EFind an entity by its idMerges the state of the given unmanaged entity.voidSaves the given entity.<E extends T>
voidsaveAll(@NotNull Collection<E> entities) Save all entities in the collection to the databaseMethods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplateMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
BambooHibernateObjectDao
public BambooHibernateObjectDao()
-
-
Method Details
-
save
Description copied from interface:BambooObjectDaoSaves the given entity. If the entity implementation is an instance ofEntityObjectthis method will: - updateEntityObject.getLastModificationDate()- setEntityObject.getCreationDate()if the object has not been saved- Specified by:
savein interfaceBambooObjectDao<T extends BambooObject>- Parameters:
t- entity to be saved
-
saveAll
Description copied from interface:BambooObjectDaoSave all entities in the collection to the database- Specified by:
saveAllin interfaceBambooObjectDao<T extends BambooObject>- Parameters:
entities- entities to be saved to database
-
merge
@NotNull public T merge(@NotNull T unmanagedEntity, @NotNull @NotNull Class<? extends T> entityClass) Description copied from interface:BambooObjectDaoMerges the state of the given unmanaged entity.This 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, theEntityObject.getCreationDate()andEntityObject.getLastModificationDate()properties will be updated accordingly (the former only if a new database object is created).- Specified by:
mergein interfaceBambooObjectDao<T extends BambooObject>- Parameters:
unmanagedEntity- entity not managed by Hibernate to mergeentityClass- class of the entity- Returns:
- managed entity as a result of merging and persisting the data - may be either a newly created or updated database object
-
delete
Description copied from interface:BambooObjectDaoRemoves the given entity from the database- Specified by:
deletein interfaceBambooObjectDao<T extends BambooObject>- Parameters:
t- entity to be removed
-
deleteAll
Description copied from interface:BambooObjectDaoRemove all elements in the collection from database- Specified by:
deleteAllin interfaceBambooObjectDao<T extends BambooObject>- Parameters:
entities- elements to be removed from database
-
findAll
Description copied from interface:BambooObjectDaoFinds all the entities that implement the givenClass- Specified by:
findAllin interfaceBambooObjectDao<T extends BambooObject>- Parameters:
aClass- class of entity- Returns:
- entities
-
countAll
Description copied from interface:BambooObjectDaoFinds the count of all entities that implement the given Class- Specified by:
countAllin interfaceBambooObjectDao<T extends BambooObject>
-
countWithRestriction
public <E extends T> long countWithRestriction(@NotNull @NotNull Class<E> aClass, @NotNull @NotNull org.hibernate.criterion.Criterion restriction) Description copied from interface:BambooObjectDaoFinds the count of all entities that implement the given class and satisfy the provided restriction- Specified by:
countWithRestrictionin interfaceBambooObjectDao<T extends BambooObject>
-
findById
Description copied from interface:BambooObjectDaoFind an entity by its id- Specified by:
findByIdin interfaceBambooObjectDao<T extends BambooObject>- Parameters:
id- id of entityaClass- class of entity- Returns:
- entity
-
executeCountQuery
Execute count-type query and returns result- Parameters:
queryName- name of the named query to execute- Returns:
- value returned by query
-
convertSearchTermToLikeExpression
-