HHH-18632 Concurrency issue with AbstractEntityPersister#nonLazyPropertyLoadPlansByName
This commit is contained in:
parent
0f0f50de96
commit
307fb20c28
|
@ -496,7 +496,7 @@ public abstract class AbstractEntityPersister
|
||||||
private final boolean implementsLifecycle;
|
private final boolean implementsLifecycle;
|
||||||
|
|
||||||
private List<UniqueKeyEntry> uniqueKeyEntries = null; //lazily initialized
|
private List<UniqueKeyEntry> uniqueKeyEntries = null; //lazily initialized
|
||||||
private HashMap<String,SingleIdArrayLoadPlan> nonLazyPropertyLoadPlansByName;
|
private ConcurrentHashMap<String,SingleIdArrayLoadPlan> nonLazyPropertyLoadPlansByName;
|
||||||
|
|
||||||
@Deprecated(since = "6.0")
|
@Deprecated(since = "6.0")
|
||||||
public AbstractEntityPersister(
|
public AbstractEntityPersister(
|
||||||
|
@ -1671,17 +1671,17 @@ public abstract class AbstractEntityPersister
|
||||||
int propertyIndex = getPropertyIndex( fieldName );
|
int propertyIndex = getPropertyIndex( fieldName );
|
||||||
partsToSelect.add( getAttributeMapping( propertyIndex ) );
|
partsToSelect.add( getAttributeMapping( propertyIndex ) );
|
||||||
SingleIdArrayLoadPlan lazyLoanPlan;
|
SingleIdArrayLoadPlan lazyLoanPlan;
|
||||||
if ( nonLazyPropertyLoadPlansByName == null ) {
|
ConcurrentHashMap<String, SingleIdArrayLoadPlan> propertyLoadPlansByName = this.nonLazyPropertyLoadPlansByName;
|
||||||
nonLazyPropertyLoadPlansByName = new HashMap<>();
|
if ( propertyLoadPlansByName == null ) {
|
||||||
|
propertyLoadPlansByName = new ConcurrentHashMap<>();
|
||||||
lazyLoanPlan = createLazyLoanPlan( partsToSelect );
|
lazyLoanPlan = createLazyLoanPlan( partsToSelect );
|
||||||
;
|
propertyLoadPlansByName.put( fieldName, lazyLoanPlan );
|
||||||
nonLazyPropertyLoadPlansByName.put( fieldName, lazyLoanPlan );
|
this.nonLazyPropertyLoadPlansByName = propertyLoadPlansByName;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lazyLoanPlan = nonLazyPropertyLoadPlansByName.get( fieldName );
|
lazyLoanPlan = nonLazyPropertyLoadPlansByName.get( fieldName );
|
||||||
if ( lazyLoanPlan == null ) {
|
if ( lazyLoanPlan == null ) {
|
||||||
lazyLoanPlan = createLazyLoanPlan( partsToSelect );
|
lazyLoanPlan = createLazyLoanPlan( partsToSelect );
|
||||||
;
|
|
||||||
nonLazyPropertyLoadPlansByName.put( fieldName, lazyLoanPlan );
|
nonLazyPropertyLoadPlansByName.put( fieldName, lazyLoanPlan );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue