@@ -204,7 +204,7 @@ public void setStatus(Status status) {
204
204
loadedState = null ;
205
205
}
206
206
207
- final Status currentStatus = this . getStatus ();
207
+ final Status currentStatus = getStatus ();
208
208
if ( currentStatus != status ) {
209
209
setCompressedValue ( PREVIOUS_STATUS , currentStatus );
210
210
setCompressedValue ( STATUS , status );
@@ -264,10 +264,10 @@ public EntityPersister getPersister() {
264
264
@ Override
265
265
public EntityKey getEntityKey () {
266
266
if ( cachedEntityKey == null ) {
267
- if ( getId () == null ) {
267
+ if ( id == null ) {
268
268
throw new IllegalStateException ( "cannot generate an EntityKey when id is null." );
269
269
}
270
- cachedEntityKey = new EntityKey ( getId (), getPersister () );
270
+ cachedEntityKey = new EntityKey ( id , persister );
271
271
}
272
272
return cachedEntityKey ;
273
273
}
@@ -341,7 +341,8 @@ else if ( earlyInsert ) {
341
341
return !isExistsInDatabase ();
342
342
}
343
343
else {
344
- return session .getPersistenceContextInternal ().containsNullifiableEntityKey ( this ::getEntityKey );
344
+ return session .getPersistenceContextInternal ()
345
+ .containsNullifiableEntityKey ( this ::getEntityKey );
345
346
}
346
347
}
347
348
@@ -350,8 +351,10 @@ public Object getLoadedValue(String propertyName) {
350
351
if ( loadedState == null || propertyName == null ) {
351
352
return null ;
352
353
}
353
- final int index = propertyIndex ( propertyName );
354
- return index < 0 ? null : loadedState [index ];
354
+ else {
355
+ final int index = propertyIndex ( propertyName );
356
+ return index < 0 ? null : loadedState [index ];
357
+ }
355
358
}
356
359
357
360
private int propertyIndex (String propertyName ) {
@@ -365,7 +368,6 @@ public void overwriteLoadedStateCollectionValue(String propertyName, PersistentC
365
368
if ( getStatus () != READ_ONLY ) {
366
369
assert propertyName != null ;
367
370
assert loadedState != null ;
368
-
369
371
loadedState [ propertyIndex ( propertyName ) ] = collection ;
370
372
}
371
373
}
@@ -395,8 +397,8 @@ private boolean isNonDirtyViaCustomStrategy(Object entity) {
395
397
final SessionImplementor session = (SessionImplementor ) getPersistenceContext ().getSession ();
396
398
final CustomEntityDirtinessStrategy customEntityDirtinessStrategy =
397
399
session .getFactory ().getCustomEntityDirtinessStrategy ();
398
- return customEntityDirtinessStrategy .canDirtyCheck ( entity , getPersister () , session )
399
- && !customEntityDirtinessStrategy .isDirty ( entity , getPersister () , session );
400
+ return customEntityDirtinessStrategy .canDirtyCheck ( entity , persister , session )
401
+ && !customEntityDirtinessStrategy .isDirty ( entity , persister , session );
400
402
}
401
403
402
404
private boolean isNonDirtyViaTracker (Object entity ) {
@@ -437,9 +439,10 @@ public boolean isModifiableEntity() {
437
439
@ Override
438
440
public void forceLocked (Object entity , Object nextVersion ) {
439
441
version = nextVersion ;
440
- loadedState [ persister .getVersionProperty () ] = version ;
442
+ final int versionProperty = persister .getVersionProperty ();
443
+ loadedState [versionProperty ] = version ;
441
444
setLockMode ( PESSIMISTIC_FORCE_INCREMENT );
442
- persister .setValue ( entity , getPersister (). getVersionProperty () , nextVersion );
445
+ persister .setValue ( entity , versionProperty , nextVersion );
443
446
}
444
447
445
448
@ Override
@@ -497,7 +500,7 @@ public void setMaybeLazySet(@Nullable ImmutableBitSet maybeLazySet) {
497
500
@ Override
498
501
public String toString () {
499
502
return "EntityEntry"
500
- + infoString ( getPersister () .getEntityName (), id )
503
+ + infoString ( persister .getEntityName (), id )
501
504
+ '(' + getStatus () + ')' ;
502
505
}
503
506
@@ -565,7 +568,7 @@ public <T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType
565
568
if ( next == null ) {
566
569
return null ;
567
570
}
568
- if ( extraStateType .isAssignableFrom ( next .getClass () ) ) {
571
+ else if ( extraStateType .isAssignableFrom ( next .getClass () ) ) {
569
572
return (T ) next ;
570
573
}
571
574
else {
0 commit comments