public final class RowIDUserType extends AbstractWrapperUserType
P2J rowid
. This permits Hibernate to
convert this data type to and from the SQL BIGINT 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 |
---|
RowIDUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
long value into the given prepared statement, based
upon the rowid instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
rowid
instance. |
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 an rowid to/from a database
record.
|
protected java.lang.String |
toString(BaseDataType value)
Return the string value of the
long embedded in the given
rowid object value . |
assemble, disassemble, equals, getBaseValue, hashCode, instantiateRegular, instantiateUnknown, isMutable, nullSafeSet, replace
private static final int[] SQL_TYPES
public int[] sqlTypes()
public java.lang.Class returnedClass()
P2J rowid
class.public java.lang.Object deepCopy(java.lang.Object value)
rowid
instance.value
- The rowid
instance to be copied.rowid
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
rowid
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 long
.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.rowid
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
long
value into the given prepared statement, based
upon the rowid
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- A rowid
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.protected java.lang.String toString(BaseDataType value)
long
embedded in the given
rowid
object value
. The default
toString()
method of rowid
returns a
formatted, padded string, which is not suitable for our purposes.toString
in class AbstractWrapperUserType
value
- A rowid
object. It is safe to assume this will not
be null
.String
representation of the contents of
value
.