|
8 | 8 | import java.lang.invoke.MethodHandles; |
9 | 9 | import java.util.concurrent.CompletionStage; |
10 | 10 |
|
11 | | -import org.hibernate.AssertionFailure; |
12 | 11 | import org.hibernate.HibernateException; |
13 | 12 | 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; |
18 | 13 | import org.hibernate.engine.spi.SharedSessionContractImplementor; |
19 | 14 | import org.hibernate.event.spi.EventSource; |
20 | 15 | import org.hibernate.persister.entity.EntityPersister; |
@@ -89,74 +84,4 @@ public CompletionStage<Void> reactiveExecute() throws HibernateException { |
89 | 84 | } |
90 | 85 | } ); |
91 | 86 | } |
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 | | - } |
162 | 87 | } |
0 commit comments