Package org.hibernate.id
Class IdentifierGeneratorHelper
java.lang.Object
org.hibernate.id.IdentifierGeneratorHelper
Factory and helper methods for
IdentifierGenerator framework.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SerializableMarker object returned fromIdentifierGenerator.generate(org.hibernate.engine.SessionImplementor, java.lang.Object)to indicate that the entity's identifier will be generated as part of the datbase insertion.static final SerializableMarker object returned fromIdentifierGenerator.generate(org.hibernate.engine.SessionImplementor, java.lang.Object)to indicate that we should short-circuit any continued generated id checking. -
Method Summary
Modifier and TypeMethodDescriptionstatic NumbercreateNumber(long value, Class clazz) Deprecated.static BigDecimalstatic BigIntegerstatic longextractLong(IntegralDataTypeHolder holder) static SerializableExtract 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 SerializablegetGeneratedIdentity(ResultSet rs, String identifierColumnName, Type type) Get the generated identifier when using identity columnsstatic IntegralDataTypeHoldergetIntegralDataTypeHolder(Class integralType)
-
Field Details
-
SHORT_CIRCUIT_INDICATOR
Marker object returned fromIdentifierGenerator.generate(org.hibernate.engine.SessionImplementor, 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
Marker object returned fromIdentifierGenerator.generate(org.hibernate.engine.SessionImplementor, java.lang.Object)to indicate that the entity's identifier will be generated as part of the datbase insertion.
-
-
Method Details
-
getGeneratedIdentity
public static Serializable getGeneratedIdentity(ResultSet rs, String identifierColumnName, Type type) throws SQLException, HibernateException Get the generated identifier when using identity columns- Parameters:
rs- The result set from which to extract the the generated identity.identifierColumnName- The name of the identifier columntype- The expected type mapping for the identity value.- Returns:
- The generated identity value
- Throws:
SQLException- Can be thrown while accessing the result setHibernateException- Indicates a problem reading back a generated identity value.
-
get
public static Serializable get(ResultSet rs, String identifierColumnName, Type type) throws SQLException, IdentifierGenerationException 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.- Parameters:
rs- The result set from which to extract the value.identifierColumnName- The name of the identifier columntype- The expected type of the value.- Returns:
- The extracted value.
- Throws:
SQLException- Indicates problems access the result setIdentifierGenerationException- Indicates an unknown type.
-
createNumber
Deprecated.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
-
extractLong
-
extractBigInteger
-
extractBigDecimal
-
holdersinstead.