public final class DateUserType extends AbstractWrapperUserType
P2J date
. This permits Hibernate to convert this data type to and from the SQL DATE 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 |
---|
DateUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
Date value into the given prepared statement,
based upon the date instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
date
instance. |
protected java.lang.Object |
getBaseValue(java.sql.ResultSet rs,
java.lang.String column)
Extract a
Date value from a result set at a particular
column. |
protected BaseDataType |
instantiateRegular(java.lang.Object value)
Construct and return an instance of
date which wraps
value . |
protected BaseDataType |
instantiateUnknown()
Construct and return an instance of
date 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 date 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 date
class.public java.lang.Object deepCopy(java.lang.Object value)
date
instance.value
- The date
instance to be copied.date
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
Date
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()
date
which is
initialized to the unknown value.instantiateUnknown
in class AbstractWrapperUserType
date
instance which represents the unknown value.protected BaseDataType instantiateRegular(java.lang.Object value)
date
which wraps
value
.instantiateRegular
in class AbstractWrapperUserType
value
- Date value to be wrapped by a date
; will not be null
.value
wrapped in a date
.protected void bindNonNull(java.sql.PreparedStatement ps, BaseDataType value, int index) throws java.sql.SQLException
Date
value into the given prepared statement,
based upon the date
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- An integer
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.