Challenges in Upgrading Hibernate from 5.x to 6.x

Hi,

In our organization, we currently use Hibernate 5.x and are planning to upgrade to 6.x. However, we are encountering several compilation issues.

We rely heavily on hbm.xml files and have our own custom annotations, which are extensively used in building dynamic queries. These annotations are added to the hbm.xml files, and we use Hibernate tools to convert them into Java classes.

The main challenge is that in Hibernate 6.x, the Hibernate tool used for generating Java classes is no longer shipped. Although we managed to download it from the sources and compile it, the generated classes no longer contain annotations. Based on our research, it appears that these annotations are now considered unnecessary, and the mapping file alone should be sufficient for attribute mapping. However, our custom annotations are also missing in the generated Java files.

Some sources suggest migrating from hbm.xml to orm.xml, but we don’t believe this would resolve our issue. Manually creating all the generated classes and adding our annotations is not a feasible option.

Could you suggest a possible solution for this issue? Any insights would be greatly appreciated.

Thanks.

I’m not sure what tool you think is not being published anymore. If you’re referring to hbm2java, the Maven plugin code is here: hibernate-tools/maven at main · hibernate/hibernate-tools · GitHub

It’s published to Maven Central just fine: Maven Central: org.hibernate.tool:hibernate-tools-maven

Hi,

We enabled the ejb3 and jdk5 parameters to include JPA annotations in our generated entity classes. While the required JPA annotations are now present, our custom annotations are no longer being reflected.

Could you suggest a possible solution for this issue? Any insights would be greatly appreciated.

Thanks.