@@ -171,7 +171,9 @@ public void execute() throws HibernateException {
171
171
final SharedSessionContractImplementor session = getSession ();
172
172
final Object instance = getInstance ();
173
173
174
- final boolean veto = preUpdate ();
174
+ if ( preUpdate () ) {
175
+ return ;
176
+ }
175
177
176
178
final SessionFactoryImplementor factory = session .getFactory ();
177
179
Object previousVersion = this .previousVersion ;
@@ -196,27 +198,24 @@ public void execute() throws HibernateException {
196
198
else {
197
199
ck = null ;
198
200
}
199
-
200
- if ( !veto ) {
201
- persister .update (
202
- id ,
203
- state ,
204
- dirtyFields ,
205
- hasDirtyCollection ,
206
- previousState ,
207
- previousVersion ,
208
- instance ,
209
- rowId ,
210
- session
211
- );
212
- }
201
+ persister .update (
202
+ id ,
203
+ state ,
204
+ dirtyFields ,
205
+ hasDirtyCollection ,
206
+ previousState ,
207
+ previousVersion ,
208
+ instance ,
209
+ rowId ,
210
+ session
211
+ );
213
212
214
213
final EntityEntry entry = session .getPersistenceContextInternal ().getEntry ( instance );
215
214
if ( entry == null ) {
216
- throw new AssertionFailure ( "possible nonthreadsafe access to session" );
215
+ throw new AssertionFailure ( "possible non thread safe access to session" );
217
216
}
218
217
219
- if ( entry .getStatus ()== Status .MANAGED || persister .isVersionPropertyGenerated () ) {
218
+ if ( entry .getStatus () == Status .MANAGED || persister .isVersionPropertyGenerated () ) {
220
219
// get the updated snapshot of the entity state by cloning current state;
221
220
// it is safe to copy in place, since by this time no-one else (should have)
222
221
// has a reference to the array
@@ -242,12 +241,12 @@ public void execute() throws HibernateException {
242
241
243
242
final StatisticsImplementor statistics = factory .getStatistics ();
244
243
if ( persister .canWriteToCache () ) {
245
- if ( persister .isCacheInvalidationRequired () || entry .getStatus ()!= Status .MANAGED ) {
246
- persister .getCacheAccessStrategy ().remove ( session , ck );
244
+ if ( persister .isCacheInvalidationRequired () || entry .getStatus () != Status .MANAGED ) {
245
+ persister .getCacheAccessStrategy ().remove ( session , ck );
247
246
}
248
247
else if ( session .getCacheMode ().isPutEnabled () ) {
249
248
//TODO: inefficient if that cache is just going to ignore the updated state!
250
- final CacheEntry ce = persister .buildCacheEntry ( instance ,state , nextVersion , getSession () );
249
+ final CacheEntry ce = persister .buildCacheEntry ( instance , state , nextVersion , getSession () );
251
250
cacheEntry = persister .getCacheEntryStructure ().structure ( ce );
252
251
253
252
final boolean put = cacheUpdate ( persister , previousVersion , ck );
@@ -270,9 +269,10 @@ else if ( session.getCacheMode().isPutEnabled() ) {
270
269
271
270
postUpdate ();
272
271
273
- if ( statistics .isStatisticsEnabled () && ! veto ) {
272
+ if ( statistics .isStatisticsEnabled () ) {
274
273
statistics .updateEntity ( getPersister ().getEntityName () );
275
274
}
275
+
276
276
}
277
277
278
278
protected boolean cacheUpdate (EntityPersister persister , Object previousVersion , Object ck ) {
0 commit comments