FTR, after a successful build with Java 11, I typed:
sdk use java 17.0.5-tem
./gradlew hibernate-core:build
And I get lots of compilation errors.
Switching back to 11.0.17-tem, the errors are gone.