Search code examples
hibernate-toolseclipse-neon

Hibernate tools reverse engineering is not working


I'm using Hibernate tools (JBoss Tools 4.4.0.Final) in Eclipse Neon. Now I want to reverse engineer the database tables into POJO objects and Hibernate mapping files.

I followed some tutorials on how to setup Eclipse to generate the POJO objects. Everything looks great until I run the configuration. Nothing happens and no errors are thrown. Can someone help me with this? The database is an MS SQL server 2014.

My reverse engineer config file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
    <type-mapping>
        <sql-type jdbc-type="NVARCHAR" hibernate-type='String'
            not-null="true">
        </sql-type>
    </type-mapping>
    <table-filter match-name="Application" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="Company" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="Functionality" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="GeneralSettings" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="Logging" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="Role" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="RoleFunctionality"
        match-catalog="Framework" match-schema="dbo">
    </table-filter>
    <table-filter match-name="Tracing" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="User" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="UserCompany" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="UserRole" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="userSettings" match-catalog="Framework"
        match-schema="dbo">
    </table-filter>
    <table-filter match-name="sysdiagrams" match-catalog="Framework"
        match-schema="dbo" exclude="true">
    </table-filter>

</hibernate-reverse-engineering>

Solution

  • Fixed this by changing the reverse engineer file to a valid one. Eclipse Hibernate tool is not generating a valid reverse engineer file.

    Change the file to:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
    
    <hibernate-reverse-engineering>
    
    <schema-selection match-catalog="Framework"/>
    <type-mapping>
        <sql-type jdbc-type="NVARCHAR" hibernate-type="string"/>
    </type-mapping>
      <table-filter match-name="GeneralSettings"/>
      <table-filter match-name="Tracing"/>
      <table-filter match-name="userSettings"/>
      <table-filter match-name="UserRole"/>
      <table-filter match-name="Functionality"/>
      <table-filter match-name="Application"/>
      <table-filter match-name="User"/>
      <table-filter match-name="UserCompany"/>
      <table-filter match-name="RoleFunctionality"/>
      <table-filter match-name="Role"/>
      <table-filter match-name="Logging"/>
      <table-filter match-name="Company"/>
    
    </hibernate-reverse-engineering>