Deletion of obejcts

From: Jan Lendholt (jlendhol..otmail.com)
Date: Mon Nov 19 2007 - 13:48:00 EST

  • Next message: Fredrik Liden: "RE: 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



    This archive was generated by hypermail 2.0.0 : Mon Nov 19 2007 - 13:48:39 EST