Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to do a Merge in a hibernate component

 
Christian Carreno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys,

I have the following problem , CustomerVoucherAgreementImpl.class (table="E_VOUCHER_CUST_AGREEMENT") has a shared component(orderRelatedData) with his child CustomerVoucherAgreementImplCL.class (table="E_VOUCHER_CUST_AGREEMENT_CL"), and when I try to read a CustomerVoucherAgreementImplCL.class(the select statement is correctly executed and brings all the requested values), the orderRelatedData component sets to null the attributes filled by first join(E_VOUCHER_CUST_AGREEMENT).
The question is, How can I merge a component from 2 tables?.

E_VOUCHER_CUST_AGREEMENT table (CustomerVoucherAgreementImpl.class)


E_VOUCHER_CUST_AGREEMENT_CL table (CustomerVoucherAgreementImplCL.class)


CustomerAgreementOrderRelatedData.class



CustomerAgreementOrderRelatedDataCL.class


Thanks in advance.
 
Christian Carreno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found a really ugly way...

This case can be resolved by "formula", so, we have to concat the original alias and the column name.
<property name="maximumOrderRequestMonthDay" column="N_MAXREQUESTORDERMONTHDAY" type="integer" formula="customervo0_2_.N_MAXREQUESTORDERMONTHDAY" />


E_VOUCHER_CUST_AGREEMENT_CL table (CustomerVoucherAgreementImplCL.class)


Now we need to know if is it possible to define a static alias, when we define a table, for example, inside of a join element, obviously I saw the DTD and isn't possible, but maybe there is another way that you want to share with us. We know that the alias is defined by Hibernate and that's why we want to get the control of it.

Thanks in advance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic