Skip to content

Commit 53ef85e

Browse files
committed
[#1591] Remove duplicated methods and clean up
The one in ORM are now reachable
1 parent e8ff8fc commit 53ef85e

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/engine/impl/ReactiveEntityDeleteAction.java

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88
import java.lang.invoke.MethodHandles;
99
import java.util.concurrent.CompletionStage;
1010

11-
import org.hibernate.AssertionFailure;
1211
import org.hibernate.HibernateException;
1312
import org.hibernate.action.internal.EntityDeleteAction;
14-
import org.hibernate.cache.spi.access.EntityDataAccess;
15-
import org.hibernate.engine.spi.EntityEntry;
16-
import org.hibernate.engine.spi.EntityKey;
17-
import org.hibernate.engine.spi.PersistenceContext;
1813
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1914
import org.hibernate.event.spi.EventSource;
2015
import org.hibernate.persister.entity.EntityPersister;
@@ -89,74 +84,4 @@ public CompletionStage<Void> reactiveExecute() throws HibernateException {
8984
}
9085
} );
9186
}
92-
93-
//TODO: copy/paste from superclass (make it protected!)
94-
private Object getCurrentVersion() {
95-
return getPersister().isVersionPropertyGenerated()
96-
// skip if we're deleting an unloaded proxy, no need for the version
97-
&& isInstanceLoaded()
98-
// we need to grab the version value from the entity, otherwise
99-
// we have issues with generated-version entities that may have
100-
// multiple actions queued during the same flush
101-
? getPersister().getVersion( getInstance() )
102-
: getVersion();
103-
}
104-
105-
//TODO: copy/paste of postDeleteLoaded() from superclass (make it protected!)
106-
private void postDeleteLoaded(
107-
Object id,
108-
EntityPersister persister,
109-
SharedSessionContractImplementor session,
110-
Object instance,
111-
Object ck) {
112-
// After actually deleting a row, record the fact that the instance no longer
113-
// exists on the database (needed for identity-column key generation), and
114-
// remove it from the session cache
115-
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
116-
final EntityEntry entry = persistenceContext.removeEntry(instance);
117-
if ( entry == null ) {
118-
throw new AssertionFailure( "possible non-threadsafe access to session" );
119-
}
120-
entry.postDelete();
121-
final EntityKey key = entry.getEntityKey();
122-
persistenceContext.removeEntity( key );
123-
persistenceContext.removeProxy( key );
124-
removeCacheItem( ck );
125-
persistenceContext.getNaturalIdResolutions().removeSharedResolution( id, getNaturalIdValues(), persister );
126-
postDelete();
127-
}
128-
129-
//TODO: copy/paste of postDeleteUnloaded() from superclass (make it protected!)
130-
private void postDeleteUnloaded(Object id, EntityPersister persister, SharedSessionContractImplementor session, Object ck) {
131-
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
132-
final EntityKey key = session.generateEntityKey( id, persister );
133-
if ( !persistenceContext.containsDeletedUnloadedEntityKey( key ) ) {
134-
throw new AssertionFailure( "deleted proxy should be for an unloaded entity: " + key );
135-
}
136-
persistenceContext.removeProxy( key );
137-
removeCacheItem( ck );
138-
}
139-
140-
//TODO: copy/paste from superclass (make it protected!)
141-
private Object lockCacheItem() {
142-
final EntityPersister persister = getPersister();
143-
if ( persister.canWriteToCache() ) {
144-
final EntityDataAccess cache = persister.getCacheAccessStrategy();
145-
final SharedSessionContractImplementor session = getSession();
146-
final Object ck = cache.generateCacheKey( getId(), persister, session.getFactory(), session.getTenantIdentifier() );
147-
setLock( cache.lockItem( session, ck, getCurrentVersion() ) );
148-
return ck;
149-
}
150-
else {
151-
return null;
152-
}
153-
}
154-
155-
//TODO: copy/paste from superclass (make it protected!)
156-
private void removeCacheItem(Object ck) {
157-
final EntityPersister persister = getPersister();
158-
if ( persister.canWriteToCache() ) {
159-
persister.getCacheAccessStrategy().remove( getSession(), ck);
160-
}
161-
}
16287
}

hibernate-reactive-core/src/test/java/org/hibernate/reactive/testing/ReactiveAssertions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import static java.util.Comparator.comparing;
1717
import static org.assertj.core.api.Assertions.assertThat;
1818

19-
2019
/**
2120
* Utility to handle verifying the information about an expected {@link Throwable}
2221
*/

0 commit comments

Comments
 (0)