FileDocCategorySizeDatePackage
EntityAction.javaAPI DocHibernate 3.2.53454Wed Apr 11 09:25:14 BST 2007org.hibernate.action

EntityAction

public abstract class EntityAction extends Object implements Serializable, Comparable, Executable
Base class for actions relating to insert/update/delete of an entity instance.
author
Gavin King

Fields Summary
private final String
entityName
private final Serializable
id
private final Object
instance
private final org.hibernate.engine.SessionImplementor
session
private transient org.hibernate.persister.entity.EntityPersister
persister
Constructors Summary
protected EntityAction(org.hibernate.engine.SessionImplementor session, Serializable id, Object instance, org.hibernate.persister.entity.EntityPersister persister)
Instantiate an action.

param
session The session from which this action is coming.
param
id The id of the entity
param
instance The entiyt instance
param
persister The entity persister

		this.entityName = persister.getEntityName();
		this.id = id;
		this.instance = instance;
		this.session = session;
		this.persister = persister;
	
Methods Summary
public voidbeforeExecutions()

		throw new AssertionFailure( "beforeExecutions() called for non-collection action" );
	
public intcompareTo(java.lang.Object other)

		EntityAction action = ( EntityAction ) other;
		//sort first by entity name
		int roleComparison = entityName.compareTo( action.entityName );
		if ( roleComparison != 0 ) {
			return roleComparison;
		}
		else {
			//then by id
			return persister.getIdentifierType().compare( id, action.id, session.getEntityMode() );
		}
	
public java.lang.StringgetEntityName()
entity name accessor

return
The entity name

		return entityName;
	
public final java.io.SerializablegetId()
entity id accessor

return
The entity id

		if ( id instanceof DelayedPostInsertIdentifier ) {
			return session.getPersistenceContext().getEntry( instance ).getId();
		}
		return id;
	
public final java.lang.ObjectgetInstance()
entity instance accessor

return
The entity instance

		return instance;
	
public final org.hibernate.persister.entity.EntityPersistergetPersister()
entity persister accessor

return
The entity persister

		return persister;
	
public final java.io.Serializable[]getPropertySpaces()

		return persister.getPropertySpaces();
	
public final org.hibernate.engine.SessionImplementorgetSession()
originating session accessor

return
The session from which this action originated.

		return session;
	
public booleanhasAfterTransactionCompletion()

		return persister.hasCache() || hasPostCommitEventListeners();
	
protected abstract booleanhasPostCommitEventListeners()

private voidreadObject(java.io.ObjectInputStream ois)
Serialization...

param
ois Thed object stream
throws
IOException Problem performing the default stream reading
throws
ClassNotFoundException Problem performing the default stream reading

		ois.defaultReadObject();
		persister = session.getFactory().getEntityPersister( entityName );
	
public java.lang.StringtoString()

		return StringHelper.unqualify( getClass().getName() ) + MessageHelper.infoString( entityName, id );