You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "swapnil (Jira)" <ji...@apache.org> on 2021/06/04 18:28:00 UTC

[jira] [Issue Comment Deleted] (DERBY-7118) Derby with hibernate does not generate relationship mappings in *hbm.xml

     [ https://issues.apache.org/jira/browse/DERBY-7118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

swapnil updated DERBY-7118:
---------------------------
    Comment: was deleted

(was: Thank you so much Richard . Have a nice time.)

> Derby with hibernate does not generate relationship mappings in *hbm.xml
> ------------------------------------------------------------------------
>
>                 Key: DERBY-7118
>                 URL: https://issues.apache.org/jira/browse/DERBY-7118
>             Project: Derby
>          Issue Type: Bug
>          Components: Miscellaneous
>    Affects Versions: 10.14.2.0
>         Environment:  Derby 10.14.2.0, in NetBeans IDE 11.3, Hibernate ORM 5.4.31, Debian 10.9.
>            Reporter: swapnil
>            Priority: Major
>              Labels: Hibernate, debian, derby, netbeans-11
>             Fix For: 10.14.2.0
>
>
> 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*
> {code:java}
> <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>
>  {code}
> I also tried defining hibernate properties
> {code:java}
> <property name="hibernate.default_catalog">app</property>{code}
> and
> {code:java}
> <property name="hibernate.default_schema">app</property>{code}
> But no, it won't help.
> *hibernate.reveng.xml*   
> {code:java}
> <hibernate-reverse-engineering>
>  <schema-selection match-schema="APP"/>
>  <table-filter match-name="PRODUCT"/>
>  <table-filter match-name="PURCHASE_ORDER"/>
>  </hibernate-reverse-engineering>{code}
> *PurchaseOrder.hbm.xml*
> {code:java}
> <?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;gt; 
> </hibernate-mapping>
>  
> {code}
> 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.  
>   
>   
>   
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)