('binary' encoding is not supported, stored as-is)
Hi,
i know about flattned relations but now is to late to chage this 2 classes.
During testings i received the same strange behaviour even if i use
dataContext.deleteObject(..). in the db the information is deleted but the
object graph is not updated..... So if i have 2 addresses for a person and i
delete one of them, the person.getAdressArray() will give again 2
addresses. Only after i save another address for a person the will receive
the good result. If i open another browser window the
person.getAdressArray() returns the right number of addr. the person is
selected from the db on each request so is not related to the session saved
information.
----- Original Message -----
From: "Andrus Adamchik" <andru..bjectstyle.org>
To: <cayenne-use..bjectstyle.org>
Sent: Wednesday, January 26, 2005 4:14 PM
Subject: Re: strange result of deletequery
> Hello,
>
> Do not use DeleteQuery as it won't update your object graph. This is not a
> bug - DeleteQuery (and its friends - Insert and Update) work with DB
> directly. For the curious, they were used internally by Cayenne in the
> past (before we switched to BatchQuery). While DeleteQuery still works
> performing its intended operation - deleting rows from DB, I am
> considering whether we should get rid of it all together to eliminate
> confusion.
>
>> Finally, the expected behaviour was after selecting the AddPers object
>> with a selectQuery and the same expresions and deleting with
>> dataContext.deleteObject(..);
>
> Deleting an object is the correct way - you should think in terms of
> objects and go with the standard Cayenne procedure. Also you can get rid
> of AddPers class at all (if it is just a join without fields of its own)
> and map n:m as a flattened relationship to be able to do something like
> person.removeFormAddresses(address).
>
> Andrus
>
>>
>> i have a n:m relation between Address & Person tables mapped with
>> AddPers table.
>>
>> I wanted to delete the relation between a person and one address using a
>> deletequery.
>> So i did somethis like
>> Expression add = ExpressionFactory.matchExp("toAddress", a_address);
>> Expression pers = ExpressionFactory.matchExp("toPerson", a_person);
>> DeleteQuery delq = new DeleteQuery(AddPers.class, add.adnExp(pers));
>> dataContext.performNonSelectingQueyr(delq);
>> dataContect.commitChanges();
>>
>> The object Addpers was delete properly but at the nezt fetch of Person
>> it still gave me the Address i just deleted ! So i used
>> dataContext.refetchObject(person) but with no effect.
>>
>> the delete action between Addpers and address is nullfy and for person
>> the same.
>>
>> Finally, the expected behaviour was after selecting the AddPers object
>> with a selectQuery and the same expresions and deleting with
>> dataContext.deleteObject(..);
>>
>> It is a bug or i missed something in my code?
>
>
>
This archive was generated by hypermail 2.0.0 : Thu Jan 27 2005 - 10:34:34 EST