public final class DatetimeUserType extends AbstractWrapperUserType
P2J datetime
. This permits Hibernate to
convert this data type to and from the SQL TIMESTAMP data type. The unknown
value is mapped to SQL NULL.Modifier and Type | Field and Description |
---|---|
private static int[] |
SQL_TYPES
Single element array containing the SQL type constant being mapped
|
LOG, LOG_TRACE
Constructor and Description |
---|
DatetimeUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
Timestamp value into the given prepared statement,
based upon the datetime instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
datetime instance. |
protected java.lang.Object |
getBaseValue(java.sql.ResultSet rs,
java.lang.String column)
Extract a
datetime value from a result set at a particular
column. |
protected BaseDataType |
instantiateRegular(java.lang.Object value)
Construct and return an instance of
datetime which wraps
value . |
protected BaseDataType |
instantiateUnknown()
Construct and return an instance of
datetime which is
initialized to the unknown value. |
java.lang.Class |
returnedClass()
Gets the Java data type class mapped by this custom type.
|
int[] |
sqlTypes()
Get the array of SQL data type constants (in this case only a single
constant), which this classes uses to map a datetime to/from a database
record.
|
assemble, disassemble, equals, hashCode, isMutable, nullSafeGet, nullSafeSet, replace, toString
private static final int[] SQL_TYPES
public int[] sqlTypes()
public java.lang.Class returnedClass()
P2J datetime
class.public java.lang.Object deepCopy(java.lang.Object value)
datetime
instance.value
- The datetime
instance to be copied.datetime
which contains the
same internal value as value
.protected java.lang.Object getBaseValue(java.sql.ResultSet rs, java.lang.String column) throws java.sql.SQLException
datetime
value from a result set at a particular
column.getBaseValue
in class AbstractWrapperUserType
rs
- Result set containing data to be extracted.column
- Name of the column at which data will be extracted.null
.java.sql.SQLException
- if a database access error occurs.protected BaseDataType instantiateUnknown()
datetime
which is
initialized to the unknown value.instantiateUnknown
in class AbstractWrapperUserType
datetime
instance which represents the unknown value.protected BaseDataType instantiateRegular(java.lang.Object value)
datetime
which wraps
value
.instantiateRegular
in class AbstractWrapperUserType
value
- Timestamp value to be wrapped by a datetime
;
will not be null
.value
wrapped in a datetime
.protected void bindNonNull(java.sql.PreparedStatement ps, BaseDataType value, int index) throws java.sql.SQLException
Timestamp
value into the given prepared statement,
based upon the datetime
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- An datetime
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.