Add this to the https://github.com/spring-projects/spring-petclinic:
If you also change the parent pom version to spring boot 2.2.0.M4 you will get Hibernate 5.4. I also tried with 5.4.3.Final by manually setting hibernate.version. In all cases you get a java.lang.VerifyError at runtime (e.g. tests all fail). Example:
I found I can "fix" it by removing the <enableAssociationManagement>true</enableAssociationManagement>, so I guess that's a workaround.
Linux, Java 8 (and 11).
Confused. Are you saying it works for you? Because it definitely doesn’t work for me. Sorry for the confusion, but the error isn’t on compilation. You actually have to run some code. E.g. something really simple like this (or any of the existing tests):
It will fail with the verify error (unless you explicily switch off bytecode verification in your JVM).
…and it doesn’t fail if you use runtime proxies for the entities. So in that case it knows how to deal with the `Visit.petId` field being of type int. Shouldn’t it work the same for compile time enhancement?
I’ve stumbled upon this issue when I tried to convert the Spring PetClinic to a Quarkus application. I’ve reported it there as .
I’ve been able to work around the issue by changing Vet like so:
And changing Pet like so:
Maybe this helps anyone who accidentally hits the same bug.
Faced same issue, reproduced only in tests
Thanks for both reproducers! I’ve used them to verify Luis’s fix, looks all good.
N.B. for Spring Petclinic to fail I had to dig up an older version.