Class HibernateUtils


  • public class HibernateUtils
    extends Object
    • Constructor Detail

      • HibernateUtils

        public HibernateUtils()
    • Method Detail

      • getHibernateTableColumnNames

        public static List<String> getHibernateTableColumnNames​(org.hibernate.SessionFactory factory,
                                                                Class klass,
                                                                boolean includeTablePrefix)
        Uses hibernate to get all appropriate table column names for the given Hibernate model class.
        Parameters:
        factory - The active Hibernate session
        klass - The Hibernate model object
        includeTablePrefix - If true, each column name will have the table name added as a prefix
        Returns:
        A lower-case list of valid column names for the given model class.
      • validateHibernateColumnNames

        public static void validateHibernateColumnNames​(org.hibernate.SessionFactory factory,
                                                        Class klass,
                                                        boolean includeTablePrefix,
                                                        String... columnNames)
        Checks that all given column names, if not null, are appropriate table column names for the given Hibernate model class.
        Parameters:
        factory - Active hibernate session factory
        klass - Hibernate model object
        includeTablePrefix - If true, the given column names include the table name as a prefix
        columnNames - List of column names to check the validity of.
        Throws:
        IllegalArgumentException - If any of the column names are invalid.