Skip to content

Commit

Permalink
Recursively check embedded property loading.
Browse files Browse the repository at this point in the history
Also, avoid falling back into hasValue(…) code path.

See #1676
Original pull request: #1685
  • Loading branch information
mp911de committed Dec 13, 2023
1 parent e5bcc4a commit b20461c
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,15 @@ private Object readEmbedded(ConversionContext conversionContext, RelationalPrope
RowDocumentAccessor source, RelationalPersistentProperty property,
RelationalPersistentEntity<?> persistentEntity) {

if (shouldReadEmbeddable(conversionContext, property, persistentEntity, provider, source)) {
if (shouldReadEmbeddable(conversionContext, property, persistentEntity, provider)) {
return read(conversionContext, persistentEntity, source);
}

return null;
}

private boolean shouldReadEmbeddable(ConversionContext context, RelationalPersistentProperty property,
RelationalPersistentEntity<?> unwrappedEntity, RelationalPropertyValueProvider propertyValueProvider,
RowDocumentAccessor source) {
RelationalPersistentEntity<?> unwrappedEntity, RelationalPropertyValueProvider propertyValueProvider) {

OnEmpty onEmpty = property.getRequiredAnnotation(Embedded.class).onEmpty();

Expand All @@ -576,16 +575,14 @@ private boolean shouldReadEmbeddable(ConversionContext context, RelationalPersis

if (persistentProperty.isEmbedded()) {

TypeInformation<?> typeInformation = persistentProperty.getTypeInformation();
RelationalPersistentEntity<?> nestedEntity = getMappingContext()
.getRequiredPersistentEntity(persistentProperty);

RelationalPersistentEntity<?> nestedEntity = getMappingContext().getPersistentEntity(typeInformation);

if (readEmbedded(nestedContext, contextual, source, persistentProperty, nestedEntity) != null) {
if (shouldReadEmbeddable(nestedContext, persistentProperty, nestedEntity, contextual)) {
return true;
}
}

if (contextual.hasValue(persistentProperty)) {
} else if (contextual.hasValue(persistentProperty)) {
return true;
}
}
Expand Down

0 comments on commit b20461c

Please sign in to comment.