Package org.hibernate.type
Class NumericBooleanConverter
java.lang.Object
org.hibernate.type.NumericBooleanConverter
- All Implemented Interfaces:
AttributeConverter<Boolean,,Integer> BasicValueConverter<Boolean,,Integer> StandardBooleanConverter<Integer>,StandardConverter<Boolean,Integer>
Handles conversion to/from
Boolean as 0 (false) or 1 (true)- Author:
- Steve Ebersole
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToDatabaseColumn(Boolean attribute) Converts the value stored in the entity attribute into the data representation to be stored in the database.convertToEntityAttribute(Integer dbData) Converts the data stored in the database column into the value to be stored in the entity attribute.Descriptor for the Java type for the domain portion of this converterDescriptor for the Java type for the relational portion of this convertertoDomainValue(Integer relationalForm) Convert the relational form just retrieved from JDBC ResultSet into the domain form.toRelationalValue(Boolean domainForm) Convert the domain form into the relational form in preparation for storage into JDBC
-
Field Details
-
INSTANCE
Singleton access
-
-
Constructor Details
-
NumericBooleanConverter
public NumericBooleanConverter()
-
-
Method Details
-
convertToDatabaseColumn
Description copied from interface:AttributeConverterConverts the value stored in the entity attribute into the data representation to be stored in the database.- Specified by:
convertToDatabaseColumnin interfaceAttributeConverter<Boolean,Integer> - Parameters:
attribute- the entity attribute value to be converted- Returns:
- the converted data to be stored in the database column
-
convertToEntityAttribute
Description copied from interface:AttributeConverterConverts the data stored in the database column into the value to be stored in the entity attribute. Note that it is the responsibility of the converter writer to specify the correctdbDatatype for the corresponding column for use by the JDBC driver: i.e., persistence providers are not expected to do such type conversion.- Specified by:
convertToEntityAttributein interfaceAttributeConverter<Boolean,Integer> - Parameters:
dbData- the data from the database column to be converted- Returns:
- the converted value to be stored in the entity attribute
-
toDomainValue
Description copied from interface:BasicValueConverterConvert the relational form just retrieved from JDBC ResultSet into the domain form.- Specified by:
toDomainValuein interfaceBasicValueConverter<Boolean,Integer>
-
toRelationalValue
Description copied from interface:BasicValueConverterConvert the domain form into the relational form in preparation for storage into JDBC- Specified by:
toRelationalValuein interfaceBasicValueConverter<Boolean,Integer>
-
getDomainJavaType
Description copied from interface:BasicValueConverterDescriptor for the Java type for the domain portion of this converter- Specified by:
getDomainJavaTypein interfaceBasicValueConverter<Boolean,Integer>
-
getRelationalJavaType
Description copied from interface:BasicValueConverterDescriptor for the Java type for the relational portion of this converter- Specified by:
getRelationalJavaTypein interfaceBasicValueConverter<Boolean,Integer>
-