hibernate-reactive
                                
                                 hibernate-reactive copied to clipboard
                                
                                    hibernate-reactive copied to clipboard
                            
                            
                            
                        Add test for `@NotFound` annotation
See this PR for ORM: https://github.com/hibernate/hibernate-test-case-templates/pull/159
Hey, I will take a look on this one
Thanks. If it doesn’t work for ORM it probably doesn’t work for us as well. A test is what we need to begin with.
please, use this templates for the code: https://github.com/hibernate/hibernate-ide-code styles
the templates for Hibernate ORM.
@DavideD Indeed, can confirm it behaves the same regardless of @NotFound.
There is one more cases with broken reference I'm not 100% sure about, @JoinColumn(nullable = false) + @NotFound(action = NotFoundAction.IGNORE) + @ManyToOne(optional = true). It will throw an exception 'not-null property references a null or transient value' due to 'nullable = false'. This is a weird case thou..
I think the behaviour in this case makes sense. There is not an error because of the entity not being found (so NotFoundAction.IGNORE is respected). The error happens because of nullable=false. Anyway, I don't think this is a realistic scenario or something critical.
That said, I haven't checked the javadoc for @NotFound so I'm not sure which cases is supposed to cover at the moment.
This is to be fixed in ORM and then we merge the unit test, right?
Probably. Sometimes we don't use the code in ORM directly, we need to adapt it. So it depends from what the fix looks like. But it makes sense to wait for the fix in ORM.
Ok, so I will follow up after that
@DavideD seems that it was fixed in ORM in 6.x, any plans for migration yet?
@blafond Any update on this?
One thing to watch out for here: the semantics of @NotFound changed a lot in H6 IIRC. So we might not want to spend too much effort on writing tests for the old behavior, which might not even have been very well-specified.
k... I can live with that.