public final class RawUserType extends AbstractWrapperUserType
P2J raw
data type. This permits Hibernate to
convert this data type to and from the SQL VARBINARY 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 |
---|
RawUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
byte array value into the given prepared statement,
based upon the raw instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
raw instance. |
boolean |
isMutable()
Returns
true to indicate that the P2J data wrapper object
is mutable. |
java.lang.Object |
nullSafeGet(java.sql.ResultSet rs,
java.lang.String[] names,
org.hibernate.engine.spi.SessionImplementor session,
java.lang.Object owner)
Create an instance of the data type mapped by this class, based upon
a data value in the specified result set.
|
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 raw value to/from a
database record.
|
assemble, disassemble, equals, getBaseValue, hashCode, instantiateRegular, instantiateUnknown, nullSafeSet, replace, toString
private static final int[] SQL_TYPES
public boolean isMutable()
true
to indicate that the P2J data wrapper object
is mutable. DMOs which get and set these objects create a non-final
reference. Getters return the reference directly, and setters replace
the reference with that of the object provided by the caller. Hence,
changes to the DMO's state can be made by changing the wrapper's state
directly, necessitating dirty checking by Hibernate.isMutable
in interface org.hibernate.usertype.UserType
isMutable
in class AbstractWrapperUserType
true
.public int[] sqlTypes()
public java.lang.Class returnedClass()
P2J raw
class.public java.lang.Object deepCopy(java.lang.Object value)
raw
instance.value
- The raw
instance to be copied.raw
which contains the same
internal value as value
.public java.lang.Object nullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, org.hibernate.engine.spi.SessionImplementor session, java.lang.Object owner) throws java.sql.SQLException
raw
instance
which is initialized to the unknown value.nullSafeGet
in interface org.hibernate.usertype.UserType
nullSafeGet
in class AbstractWrapperUserType
rs
- Result set positioned at the record from which we will access
a byte
array.names
- Array of column names. In this case, it will contain only one
element, which represents the name of the column from which
we will access our data.session
- Not used.owner
- Owning entity; not used.raw
instance, possibly initialized to the
unknown value.java.sql.SQLException
- if an error occurs accessing the result set.protected void bindNonNull(java.sql.PreparedStatement ps, BaseDataType value, int index) throws java.sql.SQLException
byte
array value into the given prepared statement,
based upon the raw
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- A raw
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.