Class IdentifierGeneratorHelper


  • public final class IdentifierGeneratorHelper
    extends java.lang.Object
    Factory and helper methods for IdentifierGenerator framework.
    • Method Detail

      • getGeneratedIdentity

        public static java.io.Serializable getGeneratedIdentity​(java.sql.ResultSet rs,
                                                                java.lang.String identifier,
                                                                Type type,
                                                                Dialect dialect)
                                                         throws java.sql.SQLException,
                                                                HibernateException
        Get the generated identifier when using identity columns
        Parameters:
        rs - The result set from which to extract the the generated identity.
        identifier - The name of the identifier column
        type - The expected type mapping for the identity value.
        dialect - The current database dialect.
        Returns:
        The generated identity value
        Throws:
        java.sql.SQLException - Can be thrown while accessing the result set
        HibernateException - Indicates a problem reading back a generated identity value.
      • get

        public static java.io.Serializable get​(java.sql.ResultSet rs,
                                               java.lang.String identifier,
                                               Type type,
                                               Dialect dialect)
                                        throws java.sql.SQLException,
                                               IdentifierGenerationException
        Extract the value from the result set (which is assumed to already have been positioned to the appropriate row) and wrp it in the appropriate Java numeric type.
        Parameters:
        rs - The result set from which to extract the value.
        identifier - The name of the identifier column
        type - The expected type of the value.
        dialect - The current database dialect.
        Returns:
        The extracted value.
        Throws:
        java.sql.SQLException - Indicates problems access the result set
        IdentifierGenerationException - Indicates an unknown type.
      • createNumber

        @Deprecated
        public static java.lang.Number createNumber​(long value,
                                                    java.lang.Class clazz)
                                             throws IdentifierGenerationException
        Deprecated.
        Use the holders instead.
        Wrap the given value in the given Java numeric class.
        Parameters:
        value - The primitive value to wrap.
        clazz - The Java numeric type in which to wrap the value.
        Returns:
        The wrapped type.
        Throws:
        IdentifierGenerationException - Indicates an unhandled 'clazz'.
      • getIntegralDataTypeHolder

        public static IntegralDataTypeHolder getIntegralDataTypeHolder​(java.lang.Class integralType)