Skip to content

Commit

Permalink
HHH-11215 - Fix NullPointerException when collection of embeddables r…
Browse files Browse the repository at this point in the history
…eference an unaudited entity.
  • Loading branch information
Naros committed Nov 23, 2016
1 parent 1e030b2 commit b1a9676
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -104,7 +104,15 @@ public void nullSafeMapToEntityFromMap(
boolean ignoreNotFound = false;
if ( !referencedEntity.isAudited() ) {
final String referencingEntityName = enversService.getEntitiesConfigurations().getEntityNameForVersionsEntityName( (String) data.get( "$type$" ) );
ignoreNotFound = enversService.getEntitiesConfigurations().getRelationDescription( referencingEntityName, getPropertyData().getName() ).isIgnoreNotFound();
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();
}
}
if ( ignoreNotFound ) {
// Eagerly loading referenced entity to silence potential (in case of proxy)
Expand Down

0 comments on commit b1a9676

Please sign in to comment.