Package com.atlassian.bamboo.util
Class BambooHibernateUtils
java.lang.Object
com.atlassian.bamboo.util.BambooHibernateUtils
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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
For debugging onlystatic void
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) 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 Details
-
counter
-
-
Method Details
-
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
-
timed
public static <T> T timed(T objectToTime) -
flushIfNeeded
public static void flushIfNeeded(org.hibernate.Session session) -
getPropertyChanges
-
describePropertyChanges
-
getPropertyByName
-
timed
public static org.hibernate.Session timed(org.hibernate.Session session)
-