Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-7118

Derby with hibernate does not generate relationship mappings in *hbm.xml

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.14.2.0
    • 10.14.2.0
    • Miscellaneous
    •  Derby 10.14.2.0, in NetBeans IDE 11.3, Hibernate ORM 5.4.31, Debian 10.9.
    • Normal
    • Important

    Description

      I'm generating POJO from Derby 10.14.2.0 database in NetBeans IDE 11.3, Hibernate ORM 5.4.31.

      It does not generate any relationship-mappings in hbm.xml or in entity classes like many-to-one/one-to-one).

      I've used two tables from Derby sample database.

      Product and PurchaseOrder

      Product table is referenced in PurchaseOrder.

      Table PurchaseOrder has FOREIGN_KEY_PRODUCT_ID.

       

      hibernate.cfg

      <hibernate-configuration>
       <session-factory>
       <property name="hibernate.dialect">org.hibernate.dialect.DerbyTenSevenDialect</property>
       <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
       <property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property>
       <property name="hibernate.connection.username">app</property>
       <property name="hibernate.connection.password">app</property>
      <mapping resource="com/pojo/Product.hbm.xml"/>
       <mapping resource="com/pojo/PurchaseOrder.hbm.xml"/>
       </session-factory>
       </hibernate-configuration>
       

      I also tried defining hibernate properties

      <property name="hibernate.default_catalog">app</property>

      and

      <property name="hibernate.default_schema">app</property>

      But no, it won't help.

      hibernate.reveng.xml  

      <hibernate-reverse-engineering>
       <schema-selection match-schema="APP"/>
       <table-filter match-name="PRODUCT"/>
       <table-filter match-name="PURCHASE_ORDER"/>
       </hibernate-reverse-engineering>

      PurchaseOrder.hbm.xml

      <?xml version="1.0"?> 
      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 
      
      <hibernate-mapping> 
      <class name="com.pojo.PurchaseOrder" table="PURCHASE_ORDER" schema="APP" optimistic-lock="version"> 
      <id name="orderNum" type="int"> <column name="ORDER_NUM" /> 
      <generator class="assigned" /> 
      </id> <property name="customerId" type="int"> <column name="CUSTOMER_ID" not-null="true" /> 
      </property> <property name="productId" type="int"> <column name="PRODUCT_ID" not-null="true" /> </property>
       <property name="quantity" type="java.lang.Short"> <column name="QUANTITY" /> </property> 
      <property name="shippingCost" type="big_decimal"> <column name="SHIPPING_COST" precision="12" /> 
       
      
      </property> <property name="salesDate" type="date"> <column name="SALES_DATE" length="10" /> </property>
       
      <property name="shippingDate" type="date"> <column name="SHIPPING_DATE" length="10" /> </property> 
      <property name="freightCompany" type="string"> <column name="FREIGHT_COMPANY" length="30" /> 
      </property>
      </class&amp;amp;gt; 
      </hibernate-mapping>
       
      

      In above PurchaseOrder.hbm.xml file, relationship mapping should be generated but you can see it is missing.

       

      Expecting

      Wizard should generate mapping relationship like many-to-one/one-to-one) in PurchaseOrder.hbm.xml

      But why relationship mapping doesn't generating?

      With MySQL it is working fine.

      Doesn't Hibernate support Derby properly?
      What is solution?

       

      This issue already reported here https://bz.apache.org/netbeans/show_bug.cgi?id=223543 9 years ago.  

       
       
       
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            swapnil0722 swapnil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: