Class HibernateDaoUtils
java.lang.Object
com.atlassian.bamboo.persistence3.HibernateDaoUtils
A variety of methods useful when interacting with DAO objects.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindQueryParameters(@NotNull org.hibernate.query.Query query, @NotNull Map<String, Object> params) Binds named parameters to theQuery.static voidcopyTimestamp(BambooObject from, BambooObject to) static voidstatic intgetMaximumNumberOfValuesForIn(DbmsBean dbmsBean) static ListSets the given query param and runsQuery.list().static ListlistQuery(DbmsBean dbmsBean, org.hibernate.query.Query query, String queryParam1, List<?> values1, String queryParam2, List<?> values2) static voidsave(org.hibernate.Session session, Object object, Serializable id) Deprecated.since 5.8static voidsaveOrUpdate(@NotNull org.hibernate.Session session, BambooObject entity) static voidsaveOrUpdateAll(org.hibernate.Session session, @NotNull Iterable<?> entities) static <T extends com.atlassian.core.bean.EntityObject>
TsetId(T bambooObject, long id) Sets the id on the supplied object and returns it.static voidupdateTimestamp(BambooObject bambooObject)
-
Field Details
-
ORACLE_MAXIMUM_NUMBER_OF_VALUES_FOR_IN_QUERY
public static final int ORACLE_MAXIMUM_NUMBER_OF_VALUES_FOR_IN_QUERY- See Also:
-
-
Method Details
-
updateTimestamp
-
copyTimestamp
-
saveOrUpdate
public static void saveOrUpdate(@NotNull @NotNull org.hibernate.Session session, BambooObject entity) -
saveOrUpdateAll
public static void saveOrUpdateAll(org.hibernate.Session session, @NotNull @NotNull Iterable<?> entities) -
save
Deprecated.since 5.8Saves the object with the supplied id. -
deleteAll
-
bindQueryParameters
public static void bindQueryParameters(@NotNull @NotNull org.hibernate.query.Query query, @NotNull @NotNull Map<String, Object> params) throws org.hibernate.HibernateExceptionBinds named parameters to theQuery. For eachMap.Entry, the key would be the parameter name and the value would be the value to bind.If the value is a
Collection, it will be bound usingQuery.setParameterList(String, Collection).If the value is a
Date, it will be bound usingQuery.setParameter(String, Object, Type).In any other case
Query.setParameter(String, Object)will be used.- Parameters:
query- the queryparams- params to bind (values mapped by parameter names)- Throws:
org.hibernate.HibernateException
-
listQuery
public static List listQuery(DbmsBean dbmsBean, org.hibernate.query.Query query, String queryParam, List<?> values) Sets the given query param and runsQuery.list(). On Oracle, runs the query as many times as needed, in batches of 1000 values. -
listQuery
-
getMaximumNumberOfValuesForIn
-
setId
public static <T extends com.atlassian.core.bean.EntityObject> T setId(T bambooObject, long id) Sets the id on the supplied object and returns it.
-