Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Embeddable object can't be retrieved when having @Nullable fields #1245

Closed
bas001 opened this issue Dec 14, 2021 · 0 comments · Fixed by #1248
Closed

@Embeddable object can't be retrieved when having @Nullable fields #1245

bas001 opened this issue Dec 14, 2021 · 0 comments · Fixed by #1248
Labels
type: bug Something isn't working
Milestone

Comments

@bas001
Copy link

bas001 commented Dec 14, 2021

Expected Behavior

Entity Foo has @Embedded object Bar. Foo gets inserted via CrudRepository with one of the fields of Bar being null.
When retrieving Foo from Repository, @embeddable object Bar should be retrieved as inserted.

Actual Behaviour

When one of the fields of Bar is null the whole embedded object Bar is retrieved as null from the Repository.

Tracked down the error to SqlResultEntityTypeMapper:464 in micronaut-data-runtime:3.2.0.
Here null gets returned if column value is null and persistentEntity (Bar) has Annotation Embeddable.

Steps To Reproduce

Execute test EmbeddedTest in Example Application.

Environment Information

JDK 11
Micronaut 3.2.1 (Same behavior observed in Micronaut 2.5.12)
micronaut-data 3.2.0
micronaut-data-jdbc 3.2.0

Example Application

https://github.com/bas001/micronaut-data-embedded

Version

3.2.1

@bas001 bas001 changed the title Entity with @Embedded object can't be retrieved when having @Nullable fields @Embeddable object can't be retrieved when having @Nullable fields Dec 14, 2021
@dstepanov dstepanov added the type: bug Something isn't working label Dec 20, 2021
@dstepanov dstepanov added this to the 3.2.2 milestone Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants