Home > Back-end >  WARN: HHH90000028: Support for `<hibernate-mappings/>` is deprecated hibernate log
WARN: HHH90000028: Support for `<hibernate-mappings/>` is deprecated hibernate log

Time:08-24

This is the complete log message:

WARN: HHH90000028: Support for <hibernate-mappings/> is deprecated [RESOURCE : resources/hibernate-configs/hibernate-mappings/mappings.hbm.xml]; migrate to orm.xml or mapping.xml, or enable hibernate.transform_hbm_xml.enabled for on the fly transformation

I've tried to look for solutions on the internet. However, articles regarding this log message are scarce. I found this github page which is part of hibernate: DeprecationLogger.java

This part of the source code peaks my interest

/**
 * Different from {@link #deprecatedSetting} in that sometimes there is no
 * direct alternative
 */
@LogMessage(level = WARN)
@Message(
        id = 90000028,
        value = "Support for `<hibernate-mappings/>` is deprecated [%s : %s]; "  
                "migrate to orm.xml or mapping.xml, or enable `"   AvailableSettings.TRANSFORM_HBM_XML  
                "` for on the fly transformation"
)
void logDeprecatedHbmXmlProcessing(SourceType sourceType, String name);

Although, I still couldn't come up with a solution.

My questions are:

  • How to migrate to orm.xml or mapping.xml?
  • How to enable hibernate.transform_hbm_xml.enabled

CodePudding user response:

Enabling hibernate.transform_hbm_xml.enabled works by adding a config property to persistence.xml or hibernate.cfg.xml, just like every other configuration is made for Hibernate.

Migration to orm.xml (the JPA standard mapping) or mapping.xml (the JPA standard Hibernate mapping extensions) can be done with the Hibernate Gradle plugin or manually. Since this is a one time task, I would recommend that you setup a dedicated Gradle project to do the migration.

  • Related