public class HibernateDaoUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ORACLE_MAXIMUM_NUMBER_OF_VALUES_FOR_IN_QUERY |
Modifier and Type | Method and Description |
---|---|
static void |
addRestrictionIn(DbmsBean dbmsBean,
org.hibernate.Criteria criteria,
String propertyName,
List<?> values)
Adds a
Restrictions.in(String, Collection) to criteria. |
static void |
bindQueryParameters(org.hibernate.query.Query query,
Map<String,Object> params)
Binds named parameters to the
Query . |
static void |
copyTimestamp(BambooObject from,
BambooObject to) |
static void |
deleteAll(org.hibernate.Session session,
List entities) |
static <E extends BambooObject> |
execute(org.springframework.orm.hibernate5.support.HibernateDaoSupport dao,
org.springframework.orm.hibernate5.HibernateCallback action)
Deprecated.
since 5.12, use session objects directly
|
static boolean |
exists(org.springframework.orm.hibernate5.support.HibernateDaoSupport dao,
org.springframework.orm.hibernate5.HibernateCallback action)
Deprecated.
since 5.12, use session objects directly
|
static int |
getMaximumNumberOfValuesForIn(DbmsBean dbmsBean) |
static List |
listCriteria(DbmsBean dbmsBean,
Supplier<org.hibernate.Criteria> criteriaFactory,
String propertyName,
List<?> values)
Sets the given query param and runs
Criteria.list() . |
static List |
listQuery(DbmsBean dbmsBean,
Supplier<org.hibernate.query.Query> querySupplier,
String queryParam,
List<?> values)
Sets the given query param and runs
Query.list() . |
static void |
save(org.springframework.orm.hibernate5.HibernateOperations hibernateOperations,
Object object,
Serializable id)
Deprecated.
since 5.8
|
static void |
save(org.hibernate.Session session,
Object object,
Serializable id)
Deprecated.
since 5.8
|
static void |
saveAll(org.springframework.orm.hibernate5.support.HibernateDaoSupport dao,
Collection<? extends BambooObject> entities)
Deprecated.
since 5.12, use
saveOrUpdateAll(Session, Iterable) |
static void |
saveOrUpdate(org.springframework.orm.hibernate5.support.HibernateDaoSupport dao,
BambooObject entity)
Deprecated.
since 5.12, use
saveOrUpdate(Session, BambooObject) |
static void |
saveOrUpdate(org.hibernate.Session session,
BambooObject entity) |
static void |
saveOrUpdateAll(org.springframework.orm.hibernate5.HibernateOperations hibernateTemplate,
Iterable<?> entities)
Deprecated.
since 5.12, use
HibernateTemplate.execute(HibernateCallback) |
static void |
saveOrUpdateAll(org.hibernate.Session session,
Iterable<?> entities) |
static <T extends BambooObject> |
saveOrUpdateFunction(org.springframework.orm.hibernate5.HibernateTemplate hibernateTemplate)
Deprecated.
since 5.12, use Java 8 features instead
|
static <T extends com.atlassian.core.bean.EntityObject> |
setId(T bambooObject,
long id)
Sets the id on the supplied object and returns it.
|
static void |
updateTimestamp(BambooObject bambooObject) |
public static final int ORACLE_MAXIMUM_NUMBER_OF_VALUES_FOR_IN_QUERY
public static void updateTimestamp(BambooObject bambooObject)
public static void copyTimestamp(BambooObject from, BambooObject to)
@Deprecated public static void saveOrUpdate(@NotNull org.springframework.orm.hibernate5.support.HibernateDaoSupport dao, BambooObject entity)
saveOrUpdate(Session, BambooObject)
public static void saveOrUpdate(@NotNull org.hibernate.Session session, BambooObject entity)
@Deprecated public static void saveAll(@NotNull org.springframework.orm.hibernate5.support.HibernateDaoSupport dao, Collection<? extends BambooObject> entities)
saveOrUpdateAll(Session, Iterable)
public static void saveOrUpdateAll(org.hibernate.Session session, @NotNull Iterable<?> entities)
@Deprecated public static void saveOrUpdateAll(org.springframework.orm.hibernate5.HibernateOperations hibernateTemplate, Iterable<?> entities) throws org.springframework.dao.DataAccessException
HibernateTemplate.execute(HibernateCallback)
org.springframework.dao.DataAccessException
@Deprecated @Nullable public static <E extends BambooObject> E execute(@NotNull org.springframework.orm.hibernate5.support.HibernateDaoSupport dao, @NotNull org.springframework.orm.hibernate5.HibernateCallback action) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
@Deprecated public static boolean exists(@NotNull org.springframework.orm.hibernate5.support.HibernateDaoSupport dao, @NotNull org.springframework.orm.hibernate5.HibernateCallback action) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
@Deprecated public static void save(org.springframework.orm.hibernate5.HibernateOperations hibernateOperations, Object object, Serializable id)
@Deprecated public static void save(org.hibernate.Session session, Object object, Serializable id)
public static void deleteAll(org.hibernate.Session session, List entities)
@Deprecated public static <T extends BambooObject> com.google.common.base.Function<T,T> saveOrUpdateFunction(@NotNull org.springframework.orm.hibernate5.HibernateTemplate hibernateTemplate)
public static void bindQueryParameters(@NotNull org.hibernate.query.Query query, @NotNull Map<String,Object> params) throws org.hibernate.HibernateException
Query
. For each Map.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 using Query.setParameterList(String, Collection)
.
If the value is a Date
, it will be bound using Query.setParameter(String, Object, Type)
.
In any other case Query.setParameter(String, Object)
will be used.
query
- the queryparams
- params to bind (values mapped by parameter names)org.hibernate.HibernateException
public static void addRestrictionIn(DbmsBean dbmsBean, org.hibernate.Criteria criteria, String propertyName, List<?> values)
Restrictions.in(String, Collection)
to criteria. On Oracle, adds multiple or-ed in conditions, each not exceeding 1000 components.
Will fail on SQL Server if the amount of params exceeds 2000.public static List listCriteria(DbmsBean dbmsBean, Supplier<org.hibernate.Criteria> criteriaFactory, String propertyName, List<?> values)
Criteria.list()
.
On Oracle, adds multiple or-ed in conditions, each not exceeding 1000 components.
On SQL Server, runs the query as many times as needed, in batches of 1900 values.public static List listQuery(DbmsBean dbmsBean, Supplier<org.hibernate.query.Query> querySupplier, String queryParam, List<?> values)
Query.list()
. On Oracle, runs the query as many times as needed, in batches of 1000 values.public static int getMaximumNumberOfValuesForIn(DbmsBean dbmsBean)
public static <T extends com.atlassian.core.bean.EntityObject> T setId(T bambooObject, long id)
Copyright © 2018 Atlassian Software Systems Pty Ltd. All rights reserved.