You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Juergen Ebert <ju...@web.de> on 2003/10/22 10:00:03 UTC
Bug in ManageableVector ?
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
AW: Bug in ManageableVector (No, sorry, it was my mistake!)
Posted by Juergen Ebert <ju...@web.de>.
Please ignore my previous message. I've found the causing mistake in my
repository.xml shortly after posting the message. I promise to
investigate more sincere before posting to the mailing list next time.
Juergen
-----Ursprüngliche Nachricht-----
Von: ojb-user-return-12408-juergen.ebert=web.de@db.apache.org
[mailto:ojb-user-return-12408-juergen.ebert=web.de@db.apache.org] Im
Auftrag von Juergen Ebert
Gesendet: Mittwoch, 22. Oktober 2003 10:00
An: ojb-user@db.apache.org
Betreff: Bug in ManageableVector ?
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org