The
The conversion-methods of the
The class
The class
The class
The class
Patterns applied:
Callback, Strategy
Todo:
Provide more predefined implementations
FieldConversion>/code> interface defines two callback methods
for conversion from Java to Database (
javaToSql(Object source)
)
and from Database to Java (sqlToJava(Object source)
).
OJB users can use predefined FieldConversion implementations contained in
this package and can also implement their own conversions that perform
arbitrary mappings.
The usage of a FieldConversion must be declared in the FieldDescriptor
element in the repository.xml file.
FieldConversion>/code> interface may
throw a
ConversionException
to signal errors
during the conversion operations.
FieldConversionDefaultImpl
is the default
implementation of the FieldConversion>/code> interface.
This implementation does not modify its input.
Boolean2IntFieldConversion
is an
implementation of the FieldConversion>/code> interface
that provides a conversion from persistent classes attributes of type
Boolean
to rdbms columns of type BIGINT
,
INTEGER
, SMALLINT
, TINYINT
or
BIT
.
JavaDate2SqlDateFieldConversion
is an
implementation of the FieldConversion>/code> interface
that provides a conversion from persistent classes attributes of type
java.util.Date
to rdbms columns of type java.sql.Date
.
Object2ByteArrFieldConversion
is an
implementation of the FieldConversion>/code> interface
that provides a conversion from persistent classes attributes of type
java.lang.Object
(or any subtype)
to rdbms columns of a type able of holding byte arrays (CHAR
,
VARCHAR
, LONGVARCHAR
, BINARY
,
VARBINARY
, or LONGVARBINARY
).
This conversion can be useful if embedded objects can not be mapped on a
dedicated extra table but must be "inlined".
This approach is used for the mapping of DListEntry object that hold an
inlined Identity Object.