public final class DecimalUserType extends AbstractWrapperUserType
P2J decimal
. This permits Hibernate to
convert this data type to and from the SQL NUMERIC 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 |
---|
DecimalUserType() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindNonNull(java.sql.PreparedStatement ps,
BaseDataType value,
int index)
Set a
BigDecimal value into the given prepared statement,
based upon the decimal instance value . |
java.lang.Object |
deepCopy(java.lang.Object value)
Create and return a deep copy of the given
decimal 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 a decimal to/from a database
record.
|
assemble, disassemble, equals, getBaseValue, hashCode, instantiateRegular, instantiateUnknown, isMutable, nullSafeSet, replace, toString
private static final int[] SQL_TYPES
public int[] sqlTypes()
public java.lang.Class returnedClass()
P2J decimal
class.public java.lang.Object deepCopy(java.lang.Object value)
decimal
instance.value
- The decimal
instance to be copied.decimal
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
decimal
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 BigDecimal
.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.decimal
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
BigDecimal
value into the given prepared statement,
based upon the decimal
instance value
.bindNonNull
in class AbstractWrapperUserType
ps
- Prepared statement into which we will set our data.value
- A decimal
instance.index
- Index in the statement at which to write the data.java.sql.SQLException
- if an error occurs setting data into the statement.