Hi all,
I have a simple 1:n relation between Offer and OfferPosition objects.
However, given an Offer with two positions, when I delete the first and
change the remaining position, the test fails with a
KeyConstraintViolatedException. This happens both with ManageableVector
and RemovalAwareCollection as collection-class.
Any suggestions would be appreciated. I'm using 1.0 RC4.
Thanks,
Juergen
Here is the test code and the descriptor snippet:
public void testCompositeOfferPositions() {
Offer offer = new Offer();
OfferPosition pos0 = new OfferPosition();
pos0.setPosNo(0);
offer.getPositions().add(pos0);
OfferPosition pos1 = new OfferPosition();
pos1.setPosNo(1);
offer.getPositions().add(pos1);
broker.beginTransaction();
broker.store(offer);
broker.commitTransaction();
broker.clearCache();
Identity ident = new Identity(offer, broker);
offer = (Offer)broker.getObjectByIdentity(ident);
assertEquals(2, offer.getPositions().size());
offer.getPositions().remove(pos0);
assertEquals(pos1, offer.getPositions().get(0));
((OfferPosition)offer.getPositions().get(0)).setPosNo(0);
broker.beginTransaction();
broker.store(offer);
broker.commitTransaction();
}
<collection-descriptor name="positions"
element-class-ref="de.mytest.bo.OfferPosition"
auto-retrieve="true" auto-update="true" auto-delete="true"
orderby="posNo" sort="ASC"
>
<inverse-foreignkey field-ref="offerId"/>
</collection-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]