From e99eb2b7a2cd6c760055b67c29de3d0db165cd45 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Fri, 1 Sep 2017 14:27:46 +0200 Subject: [PATCH] HHH-11756 - Typo in public API method name: requiresPostCommitHanding on PostInsertEventListener --- .../action/internal/EntityDeleteAction.java | 2 +- .../internal/EntityIdentityInsertAction.java | 2 +- .../action/internal/EntityInsertAction.java | 2 +- .../action/internal/EntityUpdateAction.java | 2 +- .../event/spi/PostActionEventListener.java | 38 +++++++++++++++++++ .../event/spi/PostDeleteEventListener.java | 8 +--- .../event/spi/PostInsertEventListener.java | 17 +-------- .../event/spi/PostUpdateEventListener.java | 8 +--- 8 files changed, 48 insertions(+), 31 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/event/spi/PostActionEventListener.java diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java index ff78bbe45b..dd2ff38ab8 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java @@ -204,7 +204,7 @@ public class EntityDeleteAction extends EntityAction { protected boolean hasPostCommitEventListeners() { final EventListenerGroup group = listenerGroup( EventType.POST_COMMIT_DELETE ); for ( PostDeleteEventListener listener : group.listeners() ) { - if ( listener.requiresPostCommitHanding( getPersister() ) ) { + if ( listener.requiresPostCommitHandling( getPersister() ) ) { return true; } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java index c1fe18ee6b..ace782455b 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java @@ -118,7 +118,7 @@ public final class EntityIdentityInsertAction extends AbstractEntityInsertAction protected boolean hasPostCommitEventListeners() { final EventListenerGroup group = listenerGroup( EventType.POST_COMMIT_INSERT ); for ( PostInsertEventListener listener : group.listeners() ) { - if ( listener.requiresPostCommitHanding( getPersister() ) ) { + if ( listener.requiresPostCommitHandling( getPersister() ) ) { return true; } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java index 4a2e85ec23..2eaf7105ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java @@ -240,7 +240,7 @@ public final class EntityInsertAction extends AbstractEntityInsertAction { protected boolean hasPostCommitEventListeners() { final EventListenerGroup group = listenerGroup( EventType.POST_COMMIT_INSERT ); for ( PostInsertEventListener listener : group.listeners() ) { - if ( listener.requiresPostCommitHanding( getPersister() ) ) { + if ( listener.requiresPostCommitHandling( getPersister() ) ) { return true; } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java index f1596a6c93..54893394ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java @@ -299,7 +299,7 @@ public final class EntityUpdateAction extends EntityAction { protected boolean hasPostCommitEventListeners() { final EventListenerGroup group = listenerGroup( EventType.POST_COMMIT_UPDATE ); for ( PostUpdateEventListener listener : group.listeners() ) { - if ( listener.requiresPostCommitHanding( getPersister() ) ) { + if ( listener.requiresPostCommitHandling( getPersister() ) ) { return true; } } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PostActionEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PostActionEventListener.java new file mode 100644 index 0000000000..5e9959cbbe --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PostActionEventListener.java @@ -0,0 +1,38 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.event.spi; + +import org.hibernate.persister.entity.EntityPersister; + +/** + * @author Andrea Boriero + */ +interface PostActionEventListener { + + /** + * Does this listener require that after transaction hooks be registered? + * + * @param persister The persister for the entity in question. + * + * @return {@code true} if after transaction callbacks should be added. + * + * @deprecated use {@link #requiresPostCommitHandling(EntityPersister)} + */ + @Deprecated + boolean requiresPostCommitHanding(EntityPersister persister); + + /** + * Does this listener require that after transaction hooks be registered? + * + * @param persister The persister for the entity in question. + * + * @return {@code true} if after transaction callbacks should be added. + */ + default boolean requiresPostCommitHandling(EntityPersister persister) { + return requiresPostCommitHanding( persister ); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PostDeleteEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PostDeleteEventListener.java index e3a367529c..c028342a58 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/PostDeleteEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PostDeleteEventListener.java @@ -8,15 +8,11 @@ package org.hibernate.event.spi; import java.io.Serializable; -import org.hibernate.persister.entity.EntityPersister; - /** * Called after deleting an item from the datastore * * @author Gavin King */ -public interface PostDeleteEventListener extends Serializable { - public void onPostDelete(PostDeleteEvent event); - - public boolean requiresPostCommitHanding(EntityPersister persister); +public interface PostDeleteEventListener extends Serializable, PostActionEventListener { + void onPostDelete(PostDeleteEvent event); } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java index ea29008491..768bd0d0da 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java @@ -8,25 +8,12 @@ package org.hibernate.event.spi; import java.io.Serializable; -import org.hibernate.persister.entity.EntityPersister; - /** * Called after insterting an item in the datastore * * @author Gavin King * @author Steve Ebersole */ -public interface PostInsertEventListener extends Serializable { - public void onPostInsert(PostInsertEvent event); - - /** - * Does this listener require that after transaction hooks be registered? Typically this is {@code true} - * for post-insert event listeners, but may not be, for example, in JPA cases where there are no callbacks defined - * for the particular entity. - * - * @param persister The persister for the entity in question. - * - * @return {@code true} if after transaction callbacks should be added. - */ - public boolean requiresPostCommitHanding(EntityPersister persister); +public interface PostInsertEventListener extends Serializable, PostActionEventListener { + void onPostInsert(PostInsertEvent event); } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PostUpdateEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PostUpdateEventListener.java index 5cea7bcd6d..1324f1cabc 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/PostUpdateEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PostUpdateEventListener.java @@ -8,15 +8,11 @@ package org.hibernate.event.spi; import java.io.Serializable; -import org.hibernate.persister.entity.EntityPersister; - /** * Called after updating the datastore * * @author Gavin King */ -public interface PostUpdateEventListener extends Serializable { - public void onPostUpdate(PostUpdateEvent event); - - public boolean requiresPostCommitHanding(EntityPersister persister); +public interface PostUpdateEventListener extends Serializable, PostActionEventListener { + void onPostUpdate(PostUpdateEvent event); }