Viva Pessoal,
Eu tenho um ficheiro hbm que tem o seguinte codigo entre outro:
<joined-subclass
name="com.retek.rpm.domain.promotion.bo.TslPromotionComponentMultiBuyDetailImpl"
table="TSL_RPM_PROMO_COMP_M_B" dynamic-update="true"
persister="com.retek.rpm.domain.core.dao.RetekNormalizedEntityPersister">
<meta attribute="lazy-load-collection">zoneGroupNodes</meta>
<key column="RPM_PROMO_COMP_DETAIL_ID"/>
<property name="multiBuyPromotionType" column="MULTI_BUY_PROMO_TYPE" type="com.retek.rpm.domain.core.dao.codeconverter.TslMultiBuyTypeStringCodeConverter" not-null="true"/>
<!-- coupon to be included -->
<set name="listDetails" inverse="true" lazy="true">
<key column="RPM_PROMO_COMP_DETAIL_ID"/>
<one-to-many class="com.retek.rpm.domain.promotion.bo.TslMultiBuyListImpl"/>
</set>
</joined-subclass>
A classe TslMultiBuyListImpl é composta pelo seguinte:
public class TslMultiBuyListImpl extends FSMAbleBusinessObject implements TslMultiBuyList {
private String listDisplayId;
private TslMultiBuyListTypeCode listTypes;
private TslBuyItemTypeCode buyListType;
private Integer value;
private TslMultiBuyPromotionChangeTypeCode promotionChangeTypeCode;
private Quantity getQuantity;
private ListableVO unitOfMeasureCode;
private RetailChangeValue retailChangeValue;
private Set buyItems = new HashSet();
private Set getItems = new HashSet();
private int lockVersion;
private Integer id;
public TslMultiBuyListImpl() throws RetekBusinessException {
super();
}
public TslMultiBuyListImpl(ObjectId id) throws RetekBusinessException {
super(id);
}
public TslBuyItemTypeCode getBuyListType() {
return buyListType;
}
public void setBuyListType(TslBuyItemTypeCode buyListType) {
this.buyListType = buyListType;
}
public Quantity getGetQuantity() {
return getQuantity;
}
public void setGetQuantity(Quantity getQuantity) {
this.getQuantity = getQuantity;
}
public String getListDisplayId() {
return listDisplayId;
}
public void setListDisplayId(String listDisplayId) {
this.listDisplayId = listDisplayId;
}
public TslMultiBuyListTypeCode getListTypes() {
return listTypes;
}
public void setListTypes(TslMultiBuyListTypeCode listTypes) {
this.listTypes = listTypes;
}
public TslMultiBuyPromotionChangeTypeCode getPromotionChangeTypeCode() {
return promotionChangeTypeCode;
}
public void setPromotionChangeTypeCode(
TslMultiBuyPromotionChangeTypeCode promotionChangeTypeCode) {
this.promotionChangeTypeCode = promotionChangeTypeCode;
}
public ListableVO getUnitOfMeasureCode() {
return unitOfMeasureCode;
}
public void setUnitOfMeasureCode(ListableVO unitOfMeasureCode) {
this.unitOfMeasureCode = unitOfMeasureCode;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public RetailChangeValue getRetailChangeValue() {
return retailChangeValue;
}
public void setRetailChangeValue(RetailChangeValue retailChangeValue) {
this.retailChangeValue = retailChangeValue;
}
public void addAllGetItems(Set /* <Item> */getItems) {
this.getItems.addAll(getItems);
}
public void addAllBuyItems(Set /* <Item> */buyItems) {
this.buyItems.addAll(buyItems);
}
public Set getBuyItems() {
return buyItems;
}
public Set getGetItems() {
return getItems;
}
public int getLockVersion() {
return lockVersion;
}
public void setLockVersion(int lockVersion) {
this.lockVersion = lockVersion;
}
public Integer getId(){
return id;
}
public Class getStateModelClass() {
return null;
}
}
Também criei um ficheiro hbm para esta classe:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.retek.rpm.domain.promotion.bo.TslMultiBuyListImpl" table="TSL_RPM_PROMO_COMP_M_B_DTL">
<composite-id name="objectId" class="com.retek.platform.bo.LongObjectId" access="field"
unsaved-value="any">
<key-property name="value" column="LIST_ID" type="long"
access="field"/>
</composite-id>
<property name="listDisplayId" column="LIST_ID" insert="false" update="false" access="field"/>
<property name="listTypes" column="LIST_TYPE" type="com.retek.rpm.domain.core.dao.codeconverter.TslMultiBuyListTypeCodeConverter" insert="false" update="false" access="field"/>
<property name="buyListType" column="BUY_ITEM_TYPE" type="com.retek.rpm.domain.core.dao.codeconverter.TslMultiBuyPromotionBuyTypeCodeConverter" insert="false" update="false" access="field"/>
<property name="value" column="BUY_ITEM_VALUE" insert="false" update="false" access="field"/>
<property name="retailChangeValue" access="field"
type="com.retek.rpm.domain.promotion.dao.RetailChangeValueUserType" insert="false" update="false">
<column name="CHANGE_TYPE" not-null="false"/>
<column name="CHANGE_AMOUNT" not-null="false"/>
<column name="CHANGE_CURRENCY" not-null="false"/>
<column name="CHANGE_PERCENT" not-null="false"/>
<column name="CHANGE_SELLING_UOM" not-null="false"/>
<column name="VOUCHER_NUMBER" not-null="false"/>
<column name="VOUCHER_DESCRIPTION" not-null="false"/>
</property>
<property name="lockVersion" column="LOCK_VERSION" not-null="false" insert="false" update="false" access="field"/>
<property name="getQuantity" column="GET_QUANTITY" type="com.retek.rpm.domain.promotion.dao.QuantityUserType" not-null="false" insert="false" update="false" access="field"/>
</class>
</hibernate-mapping>
O problema que estou a ter é o seguinte:
- É inserido um registo na tabela: TSL_RPM_PROMO_COMP_M_B
- Nenhum registo é inserido na tabela referênciada pelo hbm da classe TslMultiBuyListImpl.
- Nenhum excepção é gerada.
Alguem tem resposta para o que me está a acontecer?
Muito Obrigado
Texugo