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)Code:
<hibernate-mapping>
<subclass name="CustomerVoucherAgreementImpl" extends="BaseCustomerAgreement" lazy="false" >
<join table="E_VOUCHER_CUST_AGREEMENT">
<key column="AGREEMENT_ID" not-null="true" unique="true"/>
<component name="orderRelatedData" class="CustomerAgreementOrderRelatedDataCL" lazy="false">
<property name="rememberOrderMonthDay" column="N_REMEMBERORDERMONTH_DAY" type="integer" />
<property name="maximumOrderRequestMonthDay" column="N_MAXREQUESTORDERMONTHDAY" type="integer" />
<property name="maximumOrderDeliveryMonthDay" column="N_MAX_DELIVERORDERMONTHDAY" type="integer" />
<property name="lastPersonalizedOrder" column="D_LASTPERSONALIZEDORDER" type="date" />
<property name="lastNotPersonalizedOrder" column="D_LASTNOTPERSONALIZEDORDER" type="date" />
</component>
<component name="physicalSupportSpecification" class="PhysicalSupportSpecificationCL" lazy="false">
<property name="mediaSupportTypes" column="VSMEDIAPHYSICALSUPPORTTYPE_ID" type="long" not-null="true" />
<property name="validityPeriodTypeSpecification" column="VALPERIODTPSPECIF_ID" type="long" />
</component>
<property name="deliveryStructure" column="DELIVERYNODE_ID" type="long" />
<component name="packagingSpecification" class="CustomerAgreementPackagingSpecification" lazy="false">
<property name="containerStructure" column="STRUCTURE_ID" type="long" />
</component>
</join>
</subclass>
</hibernate-mapping>
E_VOUCHER_CUST_AGREEMENT_CL table (CustomerVoucherAgreementImplCL.class)Code:
<hibernate-mapping>
<subclass name="CustomerVoucherAgreementImplCL" extends="CustomerVoucherAgreementImpl" lazy="false" >
<meta attribute="orderRelatedData" inherit="true" />
<meta attribute="physicalSupportSpecification" inherit="true" />
<join table="E_VOUCHER_CUST_AGREEMENT_CL" inverse="true">
<key column="AGREEMENT_ID"/>
<component name="orderRelatedData" class="CustomerAgreementOrderRelatedDataCL" lazy="false">
<property name="deliverFormOrder" column="B_DELIVERFORM" type="true_false" />
<property name="sendBeneficiaryList" column="B_SENDBENEFICIARYLIST" type="true_false" />
<property name="loadOrderByNodeCode" column="B_LOADORDERBYNODECODE" type="true_false" />
<property name="loadExtendedOrder" column="B_LOADEXTENDEDORDER" type="true_false" />
<component name="automaticOrderGenerationSpecification" class="AutomaticOrderGenerationSpecificationCL" lazy="false">
<property name="automaticGenerationDay" column="Q_AUTOMATICGENERATIONDAY" type="integer"></property>
<property name="automaticGeneration" column="B_AUTOMATICORDERGENERATION" type="true_false"></property>
</component>
</component>
<component name="physicalSupportSpecification" class="PhysicalSupportSpecificationCL" lazy="false">
<property name="beneficiaryExpirationTypes" column="VSBENEFICIARYEXPIRATIONTYPE_ID" type="long" />
<property name="consumptionDays" column="Q_CONSUMPTIONSDAYS" type="integer" />
<property name="noBeneficiaryExpirationTypes" column="VSNOBENEFICIARYEXPTYPE_ID" type="long" />
<property name="qtyOfMonthBeforeConsumption" column="Q_MONTHFORCREATEBEFORECONSUMPT" type="integer" />
</component>
</join>
</subclass>
</hibernate-mapping>
CustomerAgreementOrderRelatedData.classCode:
import java.util.Date;
public class CustomerAgreementOrderRelatedData {
protected Integer rememberOrderMonthDay;
protected Integer maximumOrderRequestMonthDay;
protected Integer maximumOrderDeliveryMonthDay;
protected Date lastPersonalizedOrder;
protected Date lastNotPersonalizedOrder;
protected CustomerAgreementOrderRelatedData() { }
public Date getLastNotPersonalizedOrder() {
return this.lastNotPersonalizedOrder;
}
public void setLastNotPersonalizedOrder(Date lastNotPersonalizedOrder) {
this.lastNotPersonalizedOrder = lastNotPersonalizedOrder;
}
public Date getLastPersonalizedOrder() {
return this.lastPersonalizedOrder;
}
public void setLastPersonalizedOrder(Date lastPersonalizedOrder) {
this.lastPersonalizedOrder = lastPersonalizedOrder;
}
public Integer getMaximumOrderDeliveryMonthDay() {
return this.maximumOrderDeliveryMonthDay;
}
public void setMaximumOrderDeliveryMonthDay(Integer maximumOrderDeliveryMonthDay) {
this.maximumOrderDeliveryMonthDay = maximumOrderDeliveryMonthDay;
}
public Integer getMaximumOrderRequestMonthDay() {
return this.maximumOrderRequestMonthDay;
}
public void setMaximumOrderRequestMonthDay(Integer maximumOrderRequestMonthDay) {
this.maximumOrderRequestMonthDay = maximumOrderRequestMonthDay;
}
public Integer getRememberOrderMonthDay() {
return this.rememberOrderMonthDay;
}
public void setRememberOrderMonthDay(Integer rememberOrderMonthDay) {
this.rememberOrderMonthDay = rememberOrderMonthDay;
}
}
CustomerAgreementOrderRelatedDataCL.classCode:
public class CustomerAgreementOrderRelatedDataCL extends CustomerAgreementOrderRelatedData {
private Boolean deliverFormOrder;
private Boolean sendBeneficiaryList;
private Boolean loadOrderByNodeCode;
private Boolean loadExtendedOrder;
private AutomaticOrderGenerationSpecificationCL automaticOrderGenerationSpecification;
protected CustomerAgreementOrderRelatedDataCL() {
super();
}
public Boolean getDeliverFormOrder() {
return this.deliverFormOrder;
}
public void setDeliverFormOrder(Boolean deliverFormOrder) {
this.deliverFormOrder = deliverFormOrder;
}
public Boolean getSendBeneficiaryList() {
return this.sendBeneficiaryList;
}
public void setSendBeneficiaryList(Boolean sendBeneficiaryList) {
this.sendBeneficiaryList = sendBeneficiaryList;
}
public Boolean getLoadOrderByNodeCode() {
return this.loadOrderByNodeCode;
}
public void setLoadOrderByNodeCode(Boolean loadOrderByNodeCode) {
this.loadOrderByNodeCode = loadOrderByNodeCode;
}
public Boolean getLoadExtendedOrder() {
if (this.loadExtendedOrder == null){
return Boolean.FALSE;
}
return this.loadExtendedOrder;
}
public void setLoadExtendedOrder(Boolean loadExtendedOrder) {
this.loadExtendedOrder = loadExtendedOrder;
}
public AutomaticOrderGenerationSpecificationCL getAutomaticOrderGenerationSpecification() {
return this.automaticOrderGenerationSpecification;
}
public void setAutomaticOrderGenerationSpecification(AutomaticOrderGenerationSpecificationCL automaticOrderGenerationSpecification) {
this.automaticOrderGenerationSpecification = automaticOrderGenerationSpecification;
}
}
Thanks in advance.