The idea of an automated tool to convert hbm.xml to orm.xml was mentioned at some point. I think @sebersole started implementing it, but I’m not sure what the current status is (couldn’t find it mentioned in the 7.0 migration guide).
Okay, well that was wrong. As mentioned in the PR:
Once all tests have been converted and gaps addressed (which just might mean Jira created for thre moment), we can start actually removing the code for applying hbm.xml - though that will be 8.x specific
No, orm.xml is entirely optional.
As far as I know it’s mostly useful if you cannot use annotations (entity classes coming from a separate JAR) or to pick a different mapping on startup (switching from one orm.xml to another). There might be other use cases.
orm.xml can also be mixed with annotations, and there the orm.xml mapping will be “laid over” annotations. Though I’m not sure of precedence.
Does there come a new version of Hibernate Tools with the release of Hibernate 7.x? What is this new mapping.xml is this same as orm.xml? - just the name got changed?
If I use this settings, it will convert the hbm.xml to mapping.xml? at runtime?
Our hbm.xml files are very older one, when I use the setting you mentioned, I got this exception
Caused by: java.lang.UnsupportedOperationException: Transformation of <meta/> (tooling hint) is not supported - `Origin(name=chs/pof/Sharedconductorcustomattributes.hbm.xml,type=RESOURCE)`
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.handleUnsupported(HbmXmlTransformer.java:254)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.transferToolingHints(HbmXmlTransformer.java:1028)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.transferBaseEntityInformation(HbmXmlTransformer.java:1014)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.transferRootEntity(HbmXmlTransformer.java:812)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.transferEntities(HbmXmlTransformer.java:775)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.doTransform(HbmXmlTransformer.java:226)
at org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer.transform(HbmXmlTransformer.java:181)
at org.hibernate.boot.jaxb.internal.MappingBinder.doBind(MappingBinder.java:220)
at org.hibernate.boot.jaxb.internal.AbstractBinder.doBind(AbstractBinder.java:96)
at org.hibernate.boot.jaxb.internal.AbstractBinder.bind(AbstractBinder.java:51)
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:43)
... 9 more
I forgot to mention that we use this tag to import our own annotations, with these annotations only we manager our CRUD operations. I can see that this tag is not supported while conversion.
As I said, it’s experimental.
And indeed I don’t think all features of hbm.xml can/will be supported. There’s another property for ignoring unsupported features if that’s fine by you – otherwise I’d recommend moving away from the more obscure features if you can.