public class CharacterUserType extends AbstractWrapperUserType
P2J character
. This permits Hibernate
to convert this data type to and from the SQL VARCHAR 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 |
---|
CharacterUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
String value into the given prepared statement,
based upon the character instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
character
instance. |
boolean |
equals(java.lang.Object x,
java.lang.Object y)
Tests for equality between two
character instances in a
case-sensitive manner, regardless of the case-sensitivity setting of
either. |
protected java.lang.Object |
getBaseValue(java.sql.ResultSet rs,
java.lang.String column)
Extract a
String value from a result set at a particular
column. |
int |
hashCode(java.lang.Object x)
Get the hash code of the given object in a manner that is consistent
with the equality check performed by
equals(java.lang.Object, java.lang.Object) . |
protected BaseDataType |
instantiateRegular(java.lang.Object value)
Construct and return an instance of
character which wraps
value . |
protected BaseDataType |
instantiateUnknown()
Construct and return an instance of
character 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 character to/from a
database record.
|
assemble, disassemble, isMutable, nullSafeGet, nullSafeSet, replace, toString
private static final int[] SQL_TYPES
public int[] sqlTypes()
public final java.lang.Class returnedClass()
P2J character
class.public boolean equals(java.lang.Object x, java.lang.Object y)
character
instances in a
case-sensitive manner, regardless of the case-sensitivity setting of
either. The objects are considered the same if they meet any of the
following conditions:
null
; OR
x.equalsCaseSensitively(y)
evaluates to
true
.
This method is used by Hibernate for dirty checking.
equals
in interface org.hibernate.usertype.UserType
equals
in class AbstractWrapperUserType
x
- A character
data wrapper type instance.y
- A character
data wrapper type instance.public int hashCode(java.lang.Object x)
equals(java.lang.Object, java.lang.Object)
. This
implementation simply returns the result of invoking
x.caseSensitiveHashCode()
.hashCode
in interface org.hibernate.usertype.UserType
hashCode
in class AbstractWrapperUserType
x
- A character
data wrapper type instance.public final java.lang.Object deepCopy(java.lang.Object value)
character
instance.value
- The character
instance to be copied.character
which contains the
same internal value as value
.protected final java.lang.Object getBaseValue(java.sql.ResultSet rs, java.lang.String column) throws java.sql.SQLException
String
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 final BaseDataType instantiateUnknown()
character
which is
initialized to the unknown value.instantiateUnknown
in class AbstractWrapperUserType
character
instance which represents the unknown
value.protected final BaseDataType instantiateRegular(java.lang.Object value)
character
which wraps
value
.instantiateRegular
in class AbstractWrapperUserType
value
- String value to be wrapped by a character
;
will not be null
.value
wrapped in a character
.protected final void bindNonNull(java.sql.PreparedStatement ps, BaseDataType value, int index) throws java.sql.SQLException
String
value into the given prepared statement,
based upon the character
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- A character
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.