File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes How to do a Merge in a hibernate component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to do a Merge in a hibernate component" Watch "How to do a Merge in a hibernate component" New topic
Author

How to do a Merge in a hibernate component

Christian Carreno
Greenhorn

Joined: Jul 28, 2011
Posts: 2
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

Joined: Jul 28, 2011
Posts: 2
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do a Merge in a hibernate component