aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to do a Merge in a hibernate component
 
Similar Threads
ORA-00001: unique constraint exception
One to many Relation
Foreign key must have same number of columns
Criteria Qurey for Composite key table
How to persist objects having circular references using Hibernate