com.atlassian.bamboo.persistence3
Class HibernateDaoUtils

java.lang.Object
  extended by com.atlassian.bamboo.persistence3.HibernateDaoUtils

public class HibernateDaoUtils
extends Object

A variety of methods useful when interacting with DAO objects.


Method Summary
static void bindQueryParameters(org.hibernate.Query query, Map<String,Object> params)
          Binds named parameters to the Query.
static
<E extends BambooObject>
E
execute(org.springframework.orm.hibernate3.support.HibernateDaoSupport dao, org.springframework.orm.hibernate3.HibernateCallback action)
          Deprecated. since 5.9, use HibernateTemplate.execute(HibernateCallback)
static boolean exists(org.springframework.orm.hibernate3.support.HibernateDaoSupport dao, org.springframework.orm.hibernate3.HibernateCallback action)
           
static void save(org.springframework.orm.hibernate3.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.hibernate3.support.HibernateDaoSupport dao, Collection<? extends BambooObject> entities)
           
static void saveOrUpdate(org.springframework.orm.hibernate3.support.HibernateDaoSupport dao, BambooObject entity)
           
static void saveOrUpdateAll(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate, Iterable<?> entities)
           
static
<T extends BambooObject>
com.google.common.base.Function<T,T>
saveOrUpdateFunction(org.springframework.orm.hibernate3.HibernateTemplate hibernateTemplate)
           
static void updateTimestamp(BambooObject bambooObject)
           
static
<T extends BambooObject>
com.google.common.base.Function<T,T>
updateTimestampFunction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

updateTimestamp

public static void updateTimestamp(BambooObject bambooObject)

saveOrUpdate

public static void saveOrUpdate(@NotNull
                                org.springframework.orm.hibernate3.support.HibernateDaoSupport dao,
                                BambooObject entity)

saveAll

public static void saveAll(@NotNull
                           org.springframework.orm.hibernate3.support.HibernateDaoSupport dao,
                           Collection<? extends BambooObject> entities)

saveOrUpdateAll

public static void saveOrUpdateAll(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate,
                                   Iterable<?> entities)
                            throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

execute

@Deprecated
@Nullable
public static <E extends BambooObject> E execute(@NotNull
                                                                     org.springframework.orm.hibernate3.support.HibernateDaoSupport dao,
                                                                     @NotNull
                                                                     org.springframework.orm.hibernate3.HibernateCallback action)
                                      throws org.springframework.dao.DataAccessException
Deprecated. since 5.9, use HibernateTemplate.execute(HibernateCallback)

Throws:
org.springframework.dao.DataAccessException

exists

public static boolean exists(@NotNull
                             org.springframework.orm.hibernate3.support.HibernateDaoSupport dao,
                             @NotNull
                             org.springframework.orm.hibernate3.HibernateCallback action)
                      throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

save

@Deprecated
public static void save(org.springframework.orm.hibernate3.HibernateOperations hibernateOperations,
                                   Object object,
                                   Serializable id)
Deprecated. since 5.8

Saves the object with the supplied id.


save

@Deprecated
public static void save(org.hibernate.Session session,
                                   Object object,
                                   Serializable id)
Deprecated. since 5.8

Saves the object with the supplied id.


saveOrUpdateFunction

public static <T extends BambooObject> com.google.common.base.Function<T,T> saveOrUpdateFunction(@NotNull
                                                                                                 org.springframework.orm.hibernate3.HibernateTemplate hibernateTemplate)

updateTimestampFunction

public static <T extends BambooObject> com.google.common.base.Function<T,T> updateTimestampFunction()

bindQueryParameters

public static void bindQueryParameters(@NotNull
                                       org.hibernate.Query query,
                                       @NotNull
                                       Map<String,Object> params)
                                throws org.hibernate.HibernateException
Binds named parameters to the 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.setDate(String, Date).

In any other case Query.setParameter(String, Object) will be used.

Parameters:
query - the query
params - params to bind (values mapped by parameter names)
Throws:
org.hibernate.HibernateException


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.