Any action relating to insert/update/delete of a collection
| Method from org.hibernate.action.CollectionAction Detail: |
public void afterTransactionCompletion(boolean success) throws CacheException {
if ( persister.hasCache() ) {
final CacheKey ck = new CacheKey(
key,
persister.getKeyType(),
persister.getRole(),
session.getEntityMode(),
session.getFactory()
);
persister.getCacheAccessStrategy().unlockItem( ck, lock );
}
}
|
public final void beforeExecutions() throws CacheException {
// we need to obtain the lock before any actions are
// executed, since this may be an inverse="true"
// bidirectional association and it is one of the
// earlier entity actions which actually updates
// the database (this action is resposible for
// second-level cache invalidation only)
if ( persister.hasCache() ) {
final CacheKey ck = new CacheKey(
key,
persister.getKeyType(),
persister.getRole(),
session.getEntityMode(),
session.getFactory()
);
lock = persister.getCacheAccessStrategy().lockItem( ck, null );
}
}
|
public int compareTo(Object other) {
CollectionAction action = ( CollectionAction ) other;
//sort first by role name
int roleComparison = collectionRole.compareTo( action.collectionRole );
if ( roleComparison != 0 ) {
return roleComparison;
}
else {
//then by fk
return persister.getKeyType()
.compare( key, action.key, session.getEntityMode() );
}
}
|
protected final void evict() throws CacheException {
if ( persister.hasCache() ) {
CacheKey ck = new CacheKey(
key,
persister.getKeyType(),
persister.getRole(),
session.getEntityMode(),
session.getFactory()
);
persister.getCacheAccessStrategy().remove( ck );
}
}
|
protected PersistentCollection getCollection() {
return collection;
}
|
protected final Serializable getKey() {
finalKey = key;
if ( key instanceof DelayedPostInsertIdentifier ) {
// need to look it up from the persistence-context
finalKey = session.getPersistenceContext().getEntry( collection.getOwner() ).getId();
if ( finalKey == key ) {
// we may be screwed here since the collection action is about to execute
// and we do not know the final owner key value
}
}
return finalKey;
}
|
protected final CollectionPersister getPersister() {
return persister;
}
|
public Serializable[] getPropertySpaces() {
return persister.getCollectionSpaces();
}
|
protected final SessionImplementor getSession() {
return session;
}
|
public boolean hasAfterTransactionCompletion() {
return persister.hasCache();
}
|
public String toString() {
return StringHelper.unqualify( getClass().getName() ) +
MessageHelper.infoString( collectionRole, key );
}
|