Skip to content

Error message when Embeddable has a missing field name rather than th…#3803

Open
DakshRJain737 wants to merge 1 commit into
micronaut-projects:5.0.xfrom
DakshRJain737:embedable-null-field
Open

Error message when Embeddable has a missing field name rather than th…#3803
DakshRJain737 wants to merge 1 commit into
micronaut-projects:5.0.xfrom
DakshRJain737:embedable-null-field

Conversation

@DakshRJain737

Copy link
Copy Markdown

Closes: #3254

Adding a custom exception whenever an embedded null field is detected and throwing the error that displays the exact field name which is null and not the embedded object name itself.

Copilot AI review requested due to automatic review settings April 12, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Micronaut Data SQL entity mapping error reporting for embeddables by surfacing the specific null embedded field (as a dotted path) instead of only the embedded object name.

Changes:

  • Added EmbeddableNullFieldException to carry an embedded-property path and produce a more specific null-field message.
  • Updated SqlResultEntityTypeMapper to throw this exception when an @Embeddable / @EmbeddedId constructor argument is null, and to prefix nested embeddable paths when rethrowing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
data-runtime/src/main/java/io/micronaut/data/runtime/mapper/sql/SqlResultEntityTypeMapper.java Throws/propagates a dedicated exception to report dotted embedded field paths when nulls are encountered during SQL mapping.
data-model/src/main/java/io/micronaut/data/exceptions/EmbeddableNullFieldException.java Introduces a new DataAccessException subtype to represent “null embeddable field” failures with path context.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2Embedded2Spec.groovy Outdated
Comment thread data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2Embedded2Spec.groovy Outdated
Copilot AI review requested due to automatic review settings April 12, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2Embedded2Spec.groovy Outdated
Copilot AI review requested due to automatic review settings April 14, 2026 06:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings April 18, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2Embedded2Spec.groovy Outdated
@DakshRJain737

Copy link
Copy Markdown
Author

@dstepanov Good to merge???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement suggestion: Error message when Embeddable has a missing field

3 participants