org.archiviststoolkit.mydomain
Class DomainBasicObject

java.lang.Object
  extended by org.archiviststoolkit.mydomain.DomainBasicObject
All Implemented Interfaces:
java.lang.Comparable, org.hibernate.classic.Lifecycle

public abstract class DomainBasicObject
extends java.lang.Object
implements org.hibernate.classic.Lifecycle, java.lang.Comparable

The DomainObject should be the base class of all data types which we wish to store in our hibernate based database. TODO: Integer should be a Long identifier within hibernate


Field Summary
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
DomainBasicObject()
           
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares this object to another.
 boolean equals(java.lang.Object object)
          Tests objects for equality.
 java.lang.Long getIdentifier()
           
 java.lang.Long getVersion()
           
 int hashCode()
          Returns the hashcode for this object.
 boolean onDelete(org.hibernate.Session session)
          Called when an entity is deleted.
 void onLoad(org.hibernate.Session session, java.io.Serializable serialid)
          Called after an entity is loaded.
 boolean onSave(org.hibernate.Session session)
          Called when an entity is saved.
 boolean onUpdate(org.hibernate.Session session)
          Called when an entity is updated.
 void setIdentifier(java.lang.Long identifier)
           
 void setVersion(java.lang.Long version)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainBasicObject

public DomainBasicObject()
Method Detail

getIdentifier

public java.lang.Long getIdentifier()
Returns:
Returns the identifier.

setIdentifier

public void setIdentifier(java.lang.Long identifier)
Parameters:
identifier - The identifier to set.

getVersion

public final java.lang.Long getVersion()
Returns:
Returns the version.

setVersion

public final void setVersion(java.lang.Long version)
Parameters:
version - The version to set.

equals

public final boolean equals(java.lang.Object object)
Tests objects for equality.

Overrides:
equals in class java.lang.Object
Parameters:
object - the object to test against
Returns:
true if the object equals this object

hashCode

public final int hashCode()
Returns the hashcode for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode

onDelete

public final boolean onDelete(org.hibernate.Session session)
Called when an entity is deleted.

Specified by:
onDelete in interface org.hibernate.classic.Lifecycle
Parameters:
session - the session to delete on
Returns:
true to veto delete

onLoad

public void onLoad(org.hibernate.Session session,
                   java.io.Serializable serialid)
Called after an entity is loaded.

Specified by:
onLoad in interface org.hibernate.classic.Lifecycle
Parameters:
session - the session which loaded the entity
serialid - the identifier of the entity

onSave

public final boolean onSave(org.hibernate.Session session)
Called when an entity is saved.

Specified by:
onSave in interface org.hibernate.classic.Lifecycle
Parameters:
session - the session to save on
Returns:
true to veto save

onUpdate

public final boolean onUpdate(org.hibernate.Session session)
Called when an entity is updated.

Specified by:
onUpdate in interface org.hibernate.classic.Lifecycle
Parameters:
session - the session to update on
Returns:
true to veto update

compareTo

public int compareTo(java.lang.Object object)
Compares this object to another.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the object to compare this to.
Returns:
a integer result of the comparison.