# Guidance Needed: Migration Strategy from hbm.xml to orm.xml for Hibernate 7.x Upgrade

**URL:** <https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559>\
**Category:** Hibernate ORM\
**Created:** [June 12, 2025, 6:16am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559 "2025-06-12T06:16:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yashwanth](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yashwanth/32/3882_2.png) [@Yashwanth](https://discourse.hibernate.org/u/Yashwanth)\
**Post date:** [June 12, 2025, 6:16am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/1 "2025-06-12T06:16:38Z")

</div>

Hi @beikov,

Need your suggestions regarding our project upgrade path:

1. We successfully upgraded from 5.x to 6.6.x, but with 7.x release, 6.x is now in limited support
2. We haven’t converted our mapping files (800+ hbm.xml files) which we use with hibernate tools to generate entity classes
3. Questions:

- Has hbm.xml support been removed in 7.x?
- If yes, could you suggest how to migrate to orm.xml?
- Are there any tools available to generate entity classes from orm.xml?
- Manual creation of entity classes would be challenging given the volume

Your guidance on how to proceed would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [June 12, 2025, 9:32am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/2 "2025-06-12T09:32:24Z")

</div>

> [@Yashwanth](#):
>
> Has hbm.xml support been removed in 7.x?

No, what made you think that? 🤔

That’s planned (tentatively?) for 8.0.

> [@Yashwanth](#):
>
> Are there any tools available to generate entity classes from orm.xml?

Not that I know.

> [@Yashwanth](#):
>
> If yes, could you suggest how to migrate to orm.xml?

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).

---

<div class="post-metadata">

**Author:** ![Yashwanth](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yashwanth/32/3882_2.png) [@Yashwanth](https://discourse.hibernate.org/u/Yashwanth)\
**Post date:** [June 12, 2025, 11:27am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/3 "2025-06-12T11:27:58Z")

</div>

> [@yrodiere](#):
>
> No, what made you think that? 🤔

Last time, Christian said this Slight correction, ORM 7.0 might actually remove hbm.xml support already: [HHH-19324 - Switch tests using hbm.xml to use mapping.xml by sebersole · Pull Request #9956 · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/pull/9956)

I am having one more question actually, if we are having entity classes with JPA annotations do we still require a mapping file like (orm.xml)?

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [June 12, 2025, 11:33am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/4 "2025-06-12T11:33:47Z")

</div>

> [@Yashwanth](#):
>
> Last time, Christian said this Slight correction, ORM 7.0 might actually remove hbm.xml support already: [HHH-19324 - Switch tests using hbm.xml to use mapping.xml by sebersole · Pull Request #9956 · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/pull/9956)

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**

> [@Yashwanth](#):
>
> I am having one more question actually, if we are having entity classes with JPA annotations do we still require a mapping file like (orm.xml)?

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.

---

<div class="post-metadata">

**Author:** ![Yashwanth](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yashwanth/32/3882_2.png) [@Yashwanth](https://discourse.hibernate.org/u/Yashwanth)\
**Post date:** [June 12, 2025, 11:50am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/5 "2025-06-12T11:50:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [June 12, 2025, 11:58am UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/6 "2025-06-12T11:58:18Z")

</div>

> [@Yashwanth](#):
>
> Does there come a new version of Hibernate Tools with the release of Hibernate 7.x?

> **[Maven Central: org.hibernate.tool:hibernate-tools-maven](https://central.sonatype.com/artifact/org.hibernate.tool/hibernate-tools-maven/versions)**
>
> Discover hibernate-tools-maven in the org.hibernate.tool namespace. Explore metadata, contributors, the Maven POM file, and more.

> [@Yashwanth](#):
>
> What is this new mapping.xml is this same as orm.xml? - just the name got changed?

It’s just the name of Hibernate ORM’s “extended” `orm.xml`, as far as I can see. `orm.xml` still works.

> [@yrodiere](#):
>
> 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).

Oh, I just found that: [`hibernate.transform_hbm_xml.enabled`](https://docs.jboss.org/hibernate/orm/7.0/userguide/html_single/Hibernate_User_Guide.html#settings-hibernate.transform_hbm_xml.enabled). Can’t find it in the reference documentation though, it must be experimental.

---

<div class="post-metadata">

**Author:** ![Yashwanth](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yashwanth/32/3882_2.png) [@Yashwanth](https://discourse.hibernate.org/u/Yashwanth)\
**Post date:** [June 12, 2025, 1:25pm UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/7 "2025-06-12T13:25:47Z")

</div>

> [@yrodiere](#):
>
> Oh, I just found that: [`hibernate.transform_hbm_xml.enabled`](https://docs.jboss.org/hibernate/orm/7.0/userguide/html_single/Hibernate_User_Guide.html#settings-hibernate.transform_hbm_xml.enabled). Can’t find it in the reference documentation though, it must be experimental.

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [June 12, 2025, 2:38pm UTC](https://discourse.hibernate.org/t/guidance-needed-migration-strategy-from-hbm-xml-to-orm-xml-for-hibernate-7-x-upgrade/11559/8 "2025-06-12T14:38:51Z")

</div>

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.
