com.anasoft.os.daofusion.bitemporal
Class PersistentInterval

java.lang.Object
  extended by com.anasoft.os.daofusion.bitemporal.PersistentInterval
All Implemented Interfaces:
org.hibernate.usertype.CompositeUserType

public class PersistentInterval
extends java.lang.Object
implements org.hibernate.usertype.CompositeUserType

Persist Interval via Hibernate. Internally, this class collaborates with org.joda.time.contrib.hibernate.PersistentDateTime to convert the start and end components of an Interval to and from the database correspondents. This class allows clients to execute hibernate or JPA queries using the attribute names "start" and "end." For example,

"from Foo where :date is between barInterval.start and barInterval.end"

Author:
Christopher R. Gardner (chris_gardner76@yahoo.com)

Field Summary
static java.lang.String TYPE
           
 
Constructor Summary
PersistentInterval()
           
 
Method Summary
 java.lang.Object assemble(java.io.Serializable cached, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
           
 java.lang.Object deepCopy(java.lang.Object value)
           
 java.io.Serializable disassemble(java.lang.Object value, org.hibernate.engine.SessionImplementor session)
           
 boolean equals(java.lang.Object x, java.lang.Object y)
           
 java.lang.String[] getPropertyNames()
           
 org.hibernate.type.Type[] getPropertyTypes()
           
 java.lang.Object getPropertyValue(java.lang.Object component, int property)
           
 int hashCode(java.lang.Object x)
           
 boolean isMutable()
           
 java.lang.Object nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
           
 void nullSafeSet(java.sql.PreparedStatement statement, java.lang.Object value, int index, org.hibernate.engine.SessionImplementor session)
           
 java.lang.Object replace(java.lang.Object original, java.lang.Object target, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
           
 java.lang.Class<org.joda.time.Interval> returnedClass()
           
 void setPropertyValue(java.lang.Object component, int property, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values
Constructor Detail

PersistentInterval

public PersistentInterval()
Method Detail

assemble

public java.lang.Object assemble(java.io.Serializable cached,
                                 org.hibernate.engine.SessionImplementor session,
                                 java.lang.Object owner)
                          throws org.hibernate.HibernateException
Specified by:
assemble in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

deepCopy

public java.lang.Object deepCopy(java.lang.Object value)
                          throws org.hibernate.HibernateException
Specified by:
deepCopy in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

disassemble

public java.io.Serializable disassemble(java.lang.Object value,
                                        org.hibernate.engine.SessionImplementor session)
                                 throws org.hibernate.HibernateException
Specified by:
disassemble in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

equals

public boolean equals(java.lang.Object x,
                      java.lang.Object y)
               throws org.hibernate.HibernateException
Specified by:
equals in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

getPropertyNames

public java.lang.String[] getPropertyNames()
Specified by:
getPropertyNames in interface org.hibernate.usertype.CompositeUserType

getPropertyTypes

public org.hibernate.type.Type[] getPropertyTypes()
Specified by:
getPropertyTypes in interface org.hibernate.usertype.CompositeUserType

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object component,
                                         int property)
                                  throws org.hibernate.HibernateException
Specified by:
getPropertyValue in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

hashCode

public int hashCode(java.lang.Object x)
             throws org.hibernate.HibernateException
Specified by:
hashCode in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

isMutable

public boolean isMutable()
Specified by:
isMutable in interface org.hibernate.usertype.CompositeUserType

nullSafeGet

public java.lang.Object nullSafeGet(java.sql.ResultSet resultSet,
                                    java.lang.String[] names,
                                    org.hibernate.engine.SessionImplementor session,
                                    java.lang.Object owner)
                             throws org.hibernate.HibernateException,
                                    java.sql.SQLException
Specified by:
nullSafeGet in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement statement,
                        java.lang.Object value,
                        int index,
                        org.hibernate.engine.SessionImplementor session)
                 throws org.hibernate.HibernateException,
                        java.sql.SQLException
Specified by:
nullSafeSet in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

replace

public java.lang.Object replace(java.lang.Object original,
                                java.lang.Object target,
                                org.hibernate.engine.SessionImplementor session,
                                java.lang.Object owner)
                         throws org.hibernate.HibernateException
Specified by:
replace in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException

returnedClass

public java.lang.Class<org.joda.time.Interval> returnedClass()
Specified by:
returnedClass in interface org.hibernate.usertype.CompositeUserType

setPropertyValue

public void setPropertyValue(java.lang.Object component,
                             int property,
                             java.lang.Object value)
                      throws org.hibernate.HibernateException
Specified by:
setPropertyValue in interface org.hibernate.usertype.CompositeUserType
Throws:
org.hibernate.HibernateException


Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.