Package com.atlassian.bamboo.util
Class BambooHibernateUtils
- java.lang.Object
-
- com.atlassian.bamboo.util.BambooHibernateUtils
-
public class BambooHibernateUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static AtomicInteger
counter
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
createObjectWithId(Class<T> aClass, long id)
static @NotNull String
describePropertyChanges(Map<String,org.apache.commons.lang3.tuple.Pair<Object,Object>> propertyChanges)
static void
disableSqlLogging()
For debugging onlystatic void
enableSqlLogging()
For debugging onlystatic void
flushIfNeeded(org.hibernate.Session session)
static int
getConcurrentPoolSize(@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig)
Tries to get the maximum # of connections available in the connection pool and returns the lower of that and the total number of processors availablestatic int
getMaxConnectionPoolSize(@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig)
Tries to get the maximum # of connections available in the connection pool.static @Nullable Object
getPropertyByName(String name, String[] propertyNames, Object[] values)
static @NotNull Map<String,org.apache.commons.lang3.tuple.Pair<Object,Object>>
getPropertyChanges(Object[] currentState, Object[] previousState, String[] propertyNames)
static List
listWithSqlLogged(@NotNull org.hibernate.Criteria criteria, @Nullable String message)
For debugging onlystatic org.hibernate.Session
timed(org.hibernate.Session session)
static <T> T
timed(T objectToTime)
static void
withSqlLogged(@NotNull Runnable runnable, @Nullable String message)
static <T> T
withSqlLogged(@NotNull Callable<T> callable, @Nullable String message)
For debugging only
-
-
-
Field Detail
-
counter
public static final AtomicInteger counter
-
-
Method Detail
-
enableSqlLogging
public static void enableSqlLogging()
For debugging only
-
disableSqlLogging
public static void disableSqlLogging()
For debugging only
-
withSqlLogged
public static <T> T withSqlLogged(@NotNull @NotNull Callable<T> callable, @Nullable @Nullable String message) throws org.hibernate.HibernateException
For debugging only- Throws:
org.hibernate.HibernateException
-
withSqlLogged
public static void withSqlLogged(@NotNull @NotNull Runnable runnable, @Nullable @Nullable String message) throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
-
listWithSqlLogged
public static List listWithSqlLogged(@NotNull @NotNull org.hibernate.Criteria criteria, @Nullable @Nullable String message) throws org.hibernate.HibernateException
For debugging only- Throws:
org.hibernate.HibernateException
-
getMaxConnectionPoolSize
public static int getMaxConnectionPoolSize(@NotNull @NotNull com.atlassian.config.db.HibernateConfig hibernateConfig)
Tries to get the maximum # of connections available in the connection pool. IfHikariCPConstants.MAX_POOL_SIZE
property is not defined then default value is returned: 170.
-
getConcurrentPoolSize
public static int getConcurrentPoolSize(@NotNull @NotNull com.atlassian.config.db.HibernateConfig hibernateConfig)
Tries to get the maximum # of connections available in the connection pool and returns the lower of that and the total number of processors available- Parameters:
hibernateConfig
-- Returns:
-
createObjectWithId
public static <T> T createObjectWithId(Class<T> aClass, long id)
-
timed
public static <T> T timed(T objectToTime)
-
flushIfNeeded
public static void flushIfNeeded(org.hibernate.Session session)
-
getPropertyChanges
@NotNull public static @NotNull Map<String,org.apache.commons.lang3.tuple.Pair<Object,Object>> getPropertyChanges(Object[] currentState, Object[] previousState, String[] propertyNames)
-
describePropertyChanges
@NotNull public static @NotNull String describePropertyChanges(Map<String,org.apache.commons.lang3.tuple.Pair<Object,Object>> propertyChanges)
-
getPropertyByName
@Nullable public static @Nullable Object getPropertyByName(String name, String[] propertyNames, Object[] values)
-
timed
public static org.hibernate.Session timed(org.hibernate.Session session)
-
-