Package org.hibernate.id
Class IdentifierGeneratorHelper
- java.lang.Object
-
- org.hibernate.id.IdentifierGeneratorHelper
-
public final class IdentifierGeneratorHelper extends java.lang.ObjectFactory and helper methods forIdentifierGeneratorframework.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIdentifierGeneratorHelper.BasicHolderstatic classIdentifierGeneratorHelper.BigDecimalHolderstatic classIdentifierGeneratorHelper.BigIntegerHolder
-
Field Summary
Fields Modifier and Type Field Description static java.io.SerializablePOST_INSERT_INDICATORMarker object returned fromIdentifierGenerator.generate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)to indicate that the entity's identifier will be generated as part of the datbase insertion.static java.io.SerializableSHORT_CIRCUIT_INDICATORMarker object returned fromIdentifierGenerator.generate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)to indicate that we should short-circuit any continued generated id checking.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.NumbercreateNumber(long value, java.lang.Class clazz)Deprecated.Use theholdersinstead.static java.math.BigDecimalextractBigDecimal(IntegralDataTypeHolder holder)static java.math.BigIntegerextractBigInteger(IntegralDataTypeHolder holder)static longextractLong(IntegralDataTypeHolder holder)static java.io.Serializableget(java.sql.ResultSet rs, java.lang.String identifier, Type type, Dialect dialect)Extract the value from the result set (which is assumed to already have been positioned to the apopriate row) and wrp it in the appropriate Java numeric type.static java.io.SerializablegetGeneratedIdentity(java.sql.ResultSet rs, java.lang.String identifier, Type type, Dialect dialect)Get the generated identifier when using identity columnsstatic IntegralDataTypeHoldergetIntegralDataTypeHolder(java.lang.Class integralType)
-
-
-
Field Detail
-
SHORT_CIRCUIT_INDICATOR
public static final java.io.Serializable SHORT_CIRCUIT_INDICATOR
Marker object returned fromIdentifierGenerator.generate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)to indicate that we should short-circuit any continued generated id checking. Currently this is only used in the case of theforeigngenerator as a way to signal that we should use the associated entity's id value.
-
POST_INSERT_INDICATOR
public static final java.io.Serializable POST_INSERT_INDICATOR
Marker object returned fromIdentifierGenerator.generate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)to indicate that the entity's identifier will be generated as part of the datbase insertion.
-
-
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, HibernateExceptionGet 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 columntype- 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 setHibernateException- 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, IdentifierGenerationExceptionExtract the value from the result set (which is assumed to already have been positioned to the apopriate 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 columntype- The expected type of the value.dialect- The current database dialect.- Returns:
- The extracted value.
- Throws:
java.sql.SQLException- Indicates problems access the result setIdentifierGenerationException- Indicates an unknown type.
-
createNumber
@Deprecated public static java.lang.Number createNumber(long value, java.lang.Class clazz) throws IdentifierGenerationExceptionDeprecated.Use theholdersinstead.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)
-
extractLong
public static long extractLong(IntegralDataTypeHolder holder)
-
extractBigInteger
public static java.math.BigInteger extractBigInteger(IntegralDataTypeHolder holder)
-
extractBigDecimal
public static java.math.BigDecimal extractBigDecimal(IntegralDataTypeHolder holder)
-
-