Package org.opennms.netmgt.dao.hibernate
Class HibernateUtils
- java.lang.Object
-
- org.opennms.netmgt.dao.hibernate.HibernateUtils
-
public class HibernateUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description HibernateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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.
-
-
-
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 sessionklass
- The Hibernate model objectincludeTablePrefix
- 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 factoryklass
- Hibernate model objectincludeTablePrefix
- If true, the given column names include the table name as a prefixcolumnNames
- List of column names to check the validity of.- Throws:
IllegalArgumentException
- If any of the column names are invalid.
-
-