Hi Frederik, thanks for your reply.
I re-checked everything; I cannot find anything wrong on my model and code. Your assumption is correct - from From Extra to booking is 1..1. Thanks! Jan > Subject: RE: Deletion of obejcts > Date: Mon, 19 Nov 2007 12:31:30 -0700 > From: [EMAIL PROTECTED] > To: [email protected] > > Hi Jan, > > Before assuming there's something wrong with the framework let's take a > moment to consider that there may be something wrong with the code. :-) > > Deletion is one feature that definitely should work as you would expect. > Seems the reverse call is working for some reason. > Review the relationships in the model again and make sure the generated > objects are up-to-date. I've encountered the same problem before but > that had to do with some incorrectlty specified obj relationships. > > Btw, I'm assuming you have (1..n)from Booking to Extra. And one to one > (1..1) from Extra to Booking. > > Fredrik > > > -----Original Message----- > From: Jan Lendholt [mailto:[EMAIL PROTECTED] > Sent: Monday, November 19, 2007 11:48 AM > To: [email protected] > Subject: Deletion of obejcts > > Hey folks, > > I got pretty frustrated in the meantime with cayenne, as i think there > are happing some pretty ugly thingsin cayenne's internals. > > At first, I again need help on deleting objects with relationships. > > Let's say I've got one table called "booking" with its entity Booking. > And I've got another table extras with entity Extras. > > The relationship is from booking to Extras one to many (1-n entries in > Extra for one booking entry). > I've set both relationships with delete rule to nullify. > > Now, sime pseudo-code: > > Booking booking = ...; > > List<Extras> extras = booking.getExtrasArray(); > > for (int i= 0;...) > { > booking.getDataContext().deleteObject(extras.get(i)); > > } > > commitChanges(); > > Now, the data are deleted from the database. > But if I do a booking.getExtrasArray(); again, it still contains the > deleted objects; it seems as if they were cached or so :-/ > Even an booking.RemoveFromExtras(extras.get(i)) won't work. > > Hiow does the deletion work correctly? I really don't understand why > cayenne won't manage that automatically, for it would be quite logic to > remove deleted objects form the object graph. > > Well, some words about the "ugly things": We had some really strange > errors coming up which are at the end quite logic, but do not help > finding the problem so wen spent about 3 hours to find it. > We deleted an entity in the modeler and recreated it. Unfortunately, > there was a reference missing. So cayenne just threw an index out of > bounds exception. I really don't understand such a behaviour either :/ > To me, such kind of errors should be handeled and analyzed automatically > by a framework, e.g. like spring does. Ok, that's it for now. Hope you > still like me :-D > > > Tahnks a lot in advance & kind regards form Hamburg! > > Jan > > > > > _________________________________________________________________ > Importieren Sie ganz einfach Ihre E-Mail Adressen in den Messenger! > http://messenger.live.de/community/neuekontakte_adressimport.html _________________________________________________________________ Die neue Version vom Windows Live Messenger ist da! http://get.live.com/messenger/overview
