1 Reply Latest reply on Aug 3, 2011 9:02 AM by Adam Warski

    hibernate3 tool not generating the entity mapping properly

    Subhadip Chatterjee Newbie

      For a recent task, I need to generate hibernate mapping files & domain-beans of 40-45 entities, out of 300+ entities in one schema. The Database is Oracle10g. When I used the hibernate3-plugin for Eclipse, to create the configuration and a new reveng.xml file, it allowed me to choose the entitites, views & synonyms (all as simple db objects), to complete the rev-eng process...After the generation is done, I found out that the mapping is little weird. For your reference I am giving a sample mapping file content:

       

      <?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 Jul 29, 2011 4:58:06 PM by Hibernate Tools 3.4.0.CR1 -->
      <hibernate-mapping>
          <class name="com.boeing.ifes.biz.domain.beans.Program" table="PROGRAM" schema="CIMCOM_17_0">
              <composite-id name="id" class="com.boeing.ifes.biz.domain.beans.ProgramId">
                  <key-property name="programId" type="string">
                      <column name="PROGRAM_ID" length="20" />
                  </key-property>
                  <key-property name="programDesc" type="string">
                      <column name="PROGRAM_DESC" length="25" />
                  </key-property>
                  <key-property name="lastUpdDt" type="date">
                      <column name="LAST_UPD_DT" length="7" />
                  </key-property>
                  <key-property name="lastUpdNm" type="string">
                      <column name="LAST_UPD_NM" length="35" />
                  </key-property>
                  <key-property name="lastUpdOrgId" type="string">
                      <column name="LAST_UPD_ORG_ID" length="5" />
                  </key-property>
                  <key-property name="suspInd" type="string">
                      <column name="SUSP_IND" length="1" />
                  </key-property>
                  <key-property name="defDisplDaysDur" type="big_decimal">
                      <column name="DEF_DISPL_DAYS_DUR" precision="22" scale="0" />
                  </key-property>
              </composite-id>
          </class>
      </hibernate-mapping>
      

       

      In the database, the {PROGRAM_ID} alone is the primary key...Also, column {DEF_DISPL_DAYS_DUR} is nullable according to the DDL. Still this generated file, is mapping each & every column under composite-id. This is happening for all the table-mappings. I'm not getting any relation between entities, either, as collections [set/list] etc. Kindly suggest what could be the issue.

       

      P.S. - The last option for me, is to write the reveng.xml file manually, to capture each of the tables, but that's going to be tedious work.