-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
@NotNull
does not add not null
to persistence unit
#46034
Comments
/cc @geoand (kotlin) |
Hello, Thanks for reporting, and for the reproducer. It does seem there is a problem with I checked that it's not related to:
For the person doing further investigation (maybe me, maybe not):
It's just a guess, but I suspect that, in Quarkus, that integrator gets triggered too late. Dev UI code relies on |
@yrodiere does that mean that even though the not null may not properly be reflected in the dev UI (which is of course still a problem, especially since we use it to populate flyway), Hibernate still adds Also for the |
I didn't check. That's possible. Though if I had to bet, I'd rather go for the option "it doesn't work either way, but for different reasons" 😅
Yep, I use Linux as well, that's why I removed |
Describe the bug
With Hibernate ORM, we have an entity that has a
@NotNull
annotation. According to documentation, Hibernate should pick this up and addnot null
to the column in the Persistent Unit. However, when you do that on Quarkus 3.18.1,not null
is not added to the persistence unit.This used to be properly applied, until at some point we discovered after a few Quarkus updates that this suddenly no longer happens, so I am not sure in which version this stopped working.
I made a small reproducer at https://gitlab.com/l.s.andringa1/quarkus-hibernate-non-null-reproducer
The project is in Kotlin since that is what we are used to. I am not sure whether it only happens on Kotlin or also on Java. I tried to put both kotlin and java entities in the same project to test, but it was not added to the same persistence unit.
Expected behavior
When
@NotNull
is added to an entity, as follows:The persistence unit (for MariaDB in this case) should look like:
Actual behavior
When
@NotNull
is added to an entity, as follows:The persistence unit looks as follows:
How to Reproduce?
Reproducer:
Output of
uname -a
orver
Windows 11 (Also tested on Ubuntu 24.10)
Output of
java -version
OpenJDK Runtime Environment Corretto-21.0.5.11.1
Quarkus version or git rev
3.18.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.12.1
Additional information
No response
The text was updated successfully, but these errors were encountered: