Class BambooHibernateUtils


  • public class BambooHibernateUtils
    extends Object
    • 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. If HikariCPConstants.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)