Hbmxml files vs annotated class files

New features are progressively added for each minor version. During the development of Hibernate 6.x, the orm.xml definition did not receive “feature-parity” of all the things that were added. We’re planning to reset this in version 7.0, though, by aligning the available features as much as possible. I cannot assure you that in the future the XML format will be always in line with annotations, but we hope to be able to keep it up to speed.

We also wanted to know about the performance of orm.xml file and how it compares to the annotated class files

Performance is relative, in one case we’re relying on reflection scanning the annotated class path, in the other we’re parsing XML files. For huge mappings (i.e. > 1000 entity types), I can see this making a difference, but for most normal applications it shouldn’t matter. Note that mappings are processed only once, at the boot time of your application, so the runtime performance won’t be affected at all.

Do you have a transformer tool which is maven based?

Not for now, we’re evaluating a possible maven plugin for the transformer in version 7.0 but there’s not definitive plan yet.

I wanted to know if you provide any transformer tool which converts the hbm.xml files to annotated class files?

Yes, the HbmXmlTransformer I already mentioned in my previous comment, you can enable it through this configuration property. Once again, it’s not perfect and it’s going to need manual corrections, but it should give you a starting point. In 7.0 we’re working a lot to make it more reliable, so you might want to wait for that.

which approach do you see is more widely adopted and would be the recommended way going forward

For modern applications, annotations are the way to go. But I understand that migrating a legacy code base which might involve different people is very hard, if not impossible at times, that’s why we’re trying to make the transformer as good as possible to ease the migration into 7.0.