Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.test.sql
Class MonetaryAmountUserType  view MonetaryAmountUserType download MonetaryAmountUserType.java

java.lang.Object
  extended byorg.hibernate.test.sql.MonetaryAmountUserType
All Implemented Interfaces:
org.hibernate.usertype.UserType

public class MonetaryAmountUserType
extends java.lang.Object
implements org.hibernate.usertype.UserType

This is a simple Hibernate custom mapping type for MonetaryAmount value types.


Field Summary
private static int[] SQL_TYPES
           
 
Constructor Summary
MonetaryAmountUserType()
           
 
Method Summary
 java.lang.Object assemble(java.io.Serializable cached, java.lang.Object owner)
          Reconstruct an object from the cacheable representation.
 java.lang.Object deepCopy(java.lang.Object value)
          Return a deep copy of the persistent state, stopping at entities and at collections.
 java.io.Serializable disassemble(java.lang.Object value)
          Transform the object into its cacheable representation.
 boolean equals(java.lang.Object x, java.lang.Object y)
          Compare two instances of the class mapped by this type for persistence "equality".
 int hashCode(java.lang.Object x)
          Get a hashcode for the instance, consistent with persistence "equality"
 boolean isMutable()
          Are objects of this type mutable?
 java.lang.Object nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, java.lang.Object owner)
          Retrieve an instance of the mapped class from a JDBC resultset.
 void nullSafeSet(java.sql.PreparedStatement statement, java.lang.Object value, int index)
          Write an instance of the mapped class to a prepared statement.
 java.lang.Object replace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)
          During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
 java.lang.Class returnedClass()
          The class returned by nullSafeGet().
 int[] sqlTypes()
          Return the SQL type codes for the columns mapped by this type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_TYPES

private static final int[] SQL_TYPES
Constructor Detail

MonetaryAmountUserType

public MonetaryAmountUserType()
Method Detail

sqlTypes

public int[] sqlTypes()
Description copied from interface: org.hibernate.usertype.UserType
Return the SQL type codes for the columns mapped by this type. The codes are defined on java.sql.Types.

Specified by:
sqlTypes in interface org.hibernate.usertype.UserType

returnedClass

public java.lang.Class returnedClass()
Description copied from interface: org.hibernate.usertype.UserType
The class returned by nullSafeGet().

Specified by:
returnedClass in interface org.hibernate.usertype.UserType

isMutable

public boolean isMutable()
Description copied from interface: org.hibernate.usertype.UserType
Are objects of this type mutable?

Specified by:
isMutable in interface org.hibernate.usertype.UserType

deepCopy

public java.lang.Object deepCopy(java.lang.Object value)
Description copied from interface: org.hibernate.usertype.UserType
Return a deep copy of the persistent state, stopping at entities and at collections. It is not necessary to copy immutable objects, or null values, in which case it is safe to simply return the argument.

Specified by:
deepCopy in interface org.hibernate.usertype.UserType

equals

public boolean equals(java.lang.Object x,
                      java.lang.Object y)
Description copied from interface: org.hibernate.usertype.UserType
Compare two instances of the class mapped by this type for persistence "equality". Equality of the persistent state.

Specified by:
equals in interface org.hibernate.usertype.UserType

nullSafeGet

public java.lang.Object nullSafeGet(java.sql.ResultSet resultSet,
                                    java.lang.String[] names,
                                    java.lang.Object owner)
                             throws org.hibernate.HibernateException,
                                    java.sql.SQLException
Description copied from interface: org.hibernate.usertype.UserType
Retrieve an instance of the mapped class from a JDBC resultset. Implementors should handle possibility of null values.

Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement statement,
                        java.lang.Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        java.sql.SQLException
Description copied from interface: org.hibernate.usertype.UserType
Write an instance of the mapped class to a prepared statement. Implementors should handle possibility of null values. A multi-column type should be written to parameters starting from index.

Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType

disassemble

public java.io.Serializable disassemble(java.lang.Object value)
                                 throws org.hibernate.HibernateException
Description copied from interface: org.hibernate.usertype.UserType
Transform the object into its cacheable representation. At the very least this method should perform a deep copy if the type is mutable. That may not be enough for some implementations, however; for example, associations must be cached as identifier values. (optional operation)

Specified by:
disassemble in interface org.hibernate.usertype.UserType

assemble

public java.lang.Object assemble(java.io.Serializable cached,
                                 java.lang.Object owner)
                          throws org.hibernate.HibernateException
Description copied from interface: org.hibernate.usertype.UserType
Reconstruct an object from the cacheable representation. At the very least this method should perform a deep copy if the type is mutable. (optional operation)

Specified by:
assemble in interface org.hibernate.usertype.UserType

replace

public java.lang.Object replace(java.lang.Object original,
                                java.lang.Object target,
                                java.lang.Object owner)
                         throws org.hibernate.HibernateException
Description copied from interface: org.hibernate.usertype.UserType
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.

Specified by:
replace in interface org.hibernate.usertype.UserType

hashCode

public int hashCode(java.lang.Object x)
             throws org.hibernate.HibernateException
Description copied from interface: org.hibernate.usertype.UserType
Get a hashcode for the instance, consistent with persistence "equality"

Specified by:
hashCode in interface org.hibernate.usertype.UserType