|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jzeno.model.AbstractEntity
public abstract class AbstractEntity
Base class that model objects can derive from. It implements the equals and hashCode operation in a generic fashion... It does not support optimistic locking.
| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
AbstractEntity()
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clone for an abstract entity takes care of a few things for you : First, clear originalValues (thus all cloned entities will return true for any isChanged(propertyName) call where the original value was not null); secondly, replace all persistent collections by new instances (to prevent collection proxies belonging to object being cloned to be associated in the database to the clone); And finally, this clone operation resets the Id property to null, waiting for the database to generate a new identity. |
int |
compareTo(java.lang.Object o)
define the natural ordering of abstract entities |
boolean |
equals(java.lang.Object other)
Equals is implemented to evaluate newly created objects, that hence do not have a unique identifier yet, as NOT identical, so that they may be added to the Set variables that manage our model relationships. |
java.lang.Object |
getChangedValue(java.lang.String propertyName)
|
java.util.Map |
getChangedValues()
|
abstract java.lang.Long |
getId()
Subclasses should implement the 'id' property and map it to the right DB column.. |
java.lang.Object |
getOriginalValue(java.lang.String propertyName)
|
java.util.Map |
getOriginalValues()
Must return the *internal* hashmap that is used for storing original values This is important because Entity detection in the AutoSync mechanism excludes the original values maps when it traverses an object graph. |
int |
hashCode()
As equals is overridden, the hashCode operation needs to be made consistent. |
boolean |
isChanged()
Returns true if any property has changed since it was loaded from the database. |
boolean |
isChanged(java.lang.String propertyName)
Returns true if the given property has changed since it was last snapshot. |
java.lang.Boolean |
isUnsaved(Entity entity)
|
void |
onDelete(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
|
boolean |
onFlushDirty(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
|
boolean |
onLoad(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
|
boolean |
onSave(Entity entity,
java.io.Serializable arg1,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
|
void |
postFlush()
Executed after an object has been flushed to the database. |
void |
preFlush()
|
abstract void |
setId(java.lang.Long id)
|
void |
snapshot()
Store the current content of this entity, for difference analysis later. |
int |
superHashCode()
For debugging purposes. |
java.lang.String |
toString()
Generic version of the toString operation. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public AbstractEntity()
| Method Detail |
|---|
public abstract java.lang.Long getId()
Subclasses should implement the 'id' property and map it to the right DB column..
getId in interface Entitypublic abstract void setId(java.lang.Long id)
setId in interface Entitypublic boolean equals(java.lang.Object other)
Equals is implemented to evaluate newly created objects, that hence do not have a unique identifier yet, as NOT identical, so that they may be added to the Set variables that manage our model relationships.
equals in class java.lang.Objectpublic int hashCode()
As equals is overridden, the hashCode operation needs to be made consistent.
hashCode in class java.lang.Objectpublic int superHashCode()
For debugging purposes.
public java.lang.String toString()
Generic version of the toString operation. By default it returns a clear description of the object type and the unique identity (identifier) of this object..
toString in class java.lang.Objectpublic java.lang.Object clone()
Clone for an abstract entity takes care of a few things for you : First, clear originalValues (thus all cloned entities will return true for any isChanged(propertyName) call where the original value was not null); secondly, replace all persistent collections by new instances (to prevent collection proxies belonging to object being cloned to be associated in the database to the clone); And finally, this clone operation resets the Id property to null, waiting for the database to generate a new identity.
clone in class java.lang.Objectpublic java.lang.Boolean isUnsaved(Entity entity)
isUnsaved in interface Entity
public void onDelete(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onDelete in interface Entityorg.hibernate.CallbackException
public boolean onFlushDirty(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onFlushDirty in interface Entityorg.hibernate.CallbackException
public boolean onLoad(Entity entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onLoad in interface Entityorg.hibernate.CallbackException
public boolean onSave(Entity entity,
java.io.Serializable arg1,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onSave in interface Entityorg.hibernate.CallbackExceptionpublic void postFlush()
Executed after an object has been flushed to the database.
postFlush in interface Entitypublic void preFlush()
preFlush in interface Entitypublic int compareTo(java.lang.Object o)
define the natural ordering of abstract entities
compareTo in interface java.lang.Comparablepublic void snapshot()
EntityStore the current content of this entity, for difference analysis later. This operation is called after calling a business facade on all loaded objects by default.
snapshot in interface Entitypublic java.lang.Object getOriginalValue(java.lang.String propertyName)
getOriginalValue in interface Entitypublic java.util.Map getOriginalValues()
Entity
getOriginalValues in interface Entitypublic java.lang.Object getChangedValue(java.lang.String propertyName)
getChangedValue in interface Entitypublic java.util.Map getChangedValues()
getChangedValues in interface Entitypublic boolean isChanged(java.lang.String propertyName)
Returns true if the given property has changed since it was last snapshot. Typically this means 'loaded from the database'.
isChanged in interface Entitypublic boolean isChanged()
Returns true if any property has changed since it was loaded from the database.
isChanged in interface Entity
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||