mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
HHH-11215 - Fix NullPointerException when collection of embeddables reference an unaudited entity.
(cherry picked from commit b1a9676146bb073cec07a44d634a1f20b763ccb7)
This commit is contained in:
parent
6a45c1ec17
commit
27982d0c12
@ -104,8 +104,16 @@ public void nullSafeMapToEntityFromMap(
|
|||||||
boolean ignoreNotFound = false;
|
boolean ignoreNotFound = false;
|
||||||
if ( !referencedEntity.isAudited() ) {
|
if ( !referencedEntity.isAudited() ) {
|
||||||
final String referencingEntityName = enversService.getEntitiesConfigurations().getEntityNameForVersionsEntityName( (String) data.get( "$type$" ) );
|
final String referencingEntityName = enversService.getEntitiesConfigurations().getEntityNameForVersionsEntityName( (String) data.get( "$type$" ) );
|
||||||
|
if ( referencingEntityName == null && primaryKey == null ) {
|
||||||
|
// HHH-11215 - Fix for NPE when Embeddable with ManyToOne inside ElementCollection
|
||||||
|
// an embeddable in an element-collection
|
||||||
|
// todo: perhaps the mapper should account for this instead?
|
||||||
|
ignoreNotFound = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
ignoreNotFound = enversService.getEntitiesConfigurations().getRelationDescription( referencingEntityName, getPropertyData().getName() ).isIgnoreNotFound();
|
ignoreNotFound = enversService.getEntitiesConfigurations().getRelationDescription( referencingEntityName, getPropertyData().getName() ).isIgnoreNotFound();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( ignoreNotFound ) {
|
if ( ignoreNotFound ) {
|
||||||
// Eagerly loading referenced entity to silence potential (in case of proxy)
|
// Eagerly loading referenced entity to silence potential (in case of proxy)
|
||||||
// EntityNotFoundException or ObjectNotFoundException. Assigning null reference.
|
// EntityNotFoundException or ObjectNotFoundException. Assigning null reference.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user