Skip to content

HHH-12770 - Document @NotFound(action = NotFoundAction.IGNORE) and FetchType.LAZY behavior #2459

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

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

vladmihalcea
Copy link
Contributor

@@ -425,6 +425,12 @@ However, you can configure this behavior so that Hibernate can ignore such an Ex

To ignore non-existing parent entity references, even though not really recommended, it's possible to use the annotation `org.hibernate.annotation.NotFound` annotation with a value of `org.hibernate.annotations.NotFoundAction.IGNORE`.

[NOTE]
====
`@ManyToOne` and `@OneToOne` associations annotated with `@NotFound(action = NotFoundAction.IGNORE)` are always fetched eagerly
Copy link
Contributor

@jwgmeligmeyling jwgmeligmeyling Jul 26, 2018

Choose a reason for hiding this comment

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

Is this true for OneToOne's though? Seems to only check the FK direction (because this is not sufficient you proposed to change it to !constrained, which is correct). Didn't see the handling for @NotFound(Ignore) there. Does @NotFound(Ignore) set !constrained?

Copy link
Contributor Author

@vladmihalcea vladmihalcea Jul 30, 2018

Choose a reason for hiding this comment

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

@jwgmeligmeyling There's a test for @OneToOne too. It's for the child-side where it replicates just like for @ManyToOne. More, this PR does not change the current behavior other than documenting it and adding a warning.

@gsmet
Copy link
Member

gsmet commented Aug 8, 2018

+1 to merge to master only.

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

Successfully merging this pull request may close these issues.

5 participants