4 Replies Latest reply on Aug 4, 2017 4:48 AM by ericxiaomingzhao

    migration from jboss AS6.1.0 to WildFly 10.1.0 Final SchemaUpdate(Configuration) Error

    ericxiaomingzhao

      Hello,

       

      I am new to wildfly and hibernate, we have an application to do the schemaUpdate in JBOSS AS 6.1.0,

       

      we have table xml file, which defined the table column.

      File: FilterTable.hbm.xml:

       

      <?xml version="1.0"?>

      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

      <!-- Generated May 27, 2008 2:54:55 PM by Hibernate Tools 3.2.1.GA

      and subsequently enhanced by J.J. Shore. Do not regenerate. -->

      <hibernate-mapping package="com.alu.cnm.cfma.ngfm.da">

          <class name="FilterTable" table="FilterTable" dynamic-insert="true" dynamic-update="true">

              <id name="FilterId" type="java.lang.Integer" >

                  <column name="alarmFilterId" default="NULL"   />

                  <generator class="native" />

              </id>

              <property name="userLabel" type="string">

                  <column name="userLabel" length="400" not-null="true" />

              </property>

      ...

      </hibernate-mapping>

       

      then we have hibernate-cfg.xml

      <?xml version="1.0" encoding="utf-8"?>

      <!DOCTYPE hibernate-configuration PUBLIC

      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

      <hibernate-configuration>

          <session-factory>

              <mapping resource="FilterTable.hbm.xml"/>

             ...

          </session-factory>

      </hibernate-configuration>

       

      in Hibernate 3, our code like this:

       

      private static final Configuration cfg = new Configuration().configure("config/hibernate.cfg.xml");

       

      SchemaUpdate su = new SchemaUpdate(cfg);

      su.execute(true, true);

       

       

      then in wildfly10.1.0 Final Version,  SchemaUpdate(Configuration) doesn't exist in hibernate 5 any more . it was changed to SchemaUpdate(MetadataImplementor), or SchemaUpdateServiceRegistry,MetadataImplementor) ,

       

      How to get the MetadataImplemntor and SerivceRegistry via Configuration file? or how can I do the SchemaUpdate if the table xml file was changed.

       

      Thanks in advance to your reply.

       

      Best Regards,

      Eric.