public final class LogicalUserType extends AbstractWrapperUserType implements org.hibernate.usertype.EnhancedUserType
P2J logical
. This permits Hibernate to
convert this data type to and from the SQL BIT 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 |
---|
LogicalUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
boolean value into the given prepared statement,
based upon the logical instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
logical
instance. |
java.lang.Object |
fromXMLString(java.lang.String xmlValue)
Parse a string representation of this value, as it appears in an XML document.
|
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.String |
objectToSQLString(java.lang.Object value)
Return an SQL literal representation of the 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 logical to/from a database
record.
|
java.lang.String |
toXMLString(java.lang.Object value)
Return a string representation of this value, as it should appear in an XML document.
|
assemble, disassemble, equals, getBaseValue, hashCode, instantiateRegular, instantiateUnknown, isMutable, nullSafeSet, replace, toString
private static final int[] SQL_TYPES
public int[] sqlTypes()
sqlTypes
in interface org.hibernate.usertype.UserType
public java.lang.Class returnedClass()
returnedClass
in interface org.hibernate.usertype.UserType
P2J logical
class.public java.lang.Object deepCopy(java.lang.Object value)
logical
instance.deepCopy
in interface org.hibernate.usertype.UserType
value
- The logical
instance to be copied.logical
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
logical
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 boolean
.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.logical
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
boolean
value into the given prepared statement,
based upon the logical
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- An logical
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.public java.lang.String objectToSQLString(java.lang.Object value)
objectToSQLString
in interface org.hibernate.usertype.EnhancedUserType
value
- Value which representation we want to get.public java.lang.String toXMLString(java.lang.Object value)
toXMLString
in interface org.hibernate.usertype.EnhancedUserType
value
- Value to covert to an XML representation.null
public java.lang.Object fromXMLString(java.lang.String xmlValue)
fromXMLString
in interface org.hibernate.usertype.EnhancedUserType
xmlValue
- XML representation of the value.null