I guess the "Cayenne way" in this situation would be to clone an
object subtree with a new PK and delete the old subtree. I.e. INSERT/
DELETE vs UPDATE. Fro the reasons that Ari stated - it is assumed that
object identity is never changed.
Andrus
On Aug 1, 2008, at 9:47 AM, Francois Eyl wrote:
First, you have to know that I have no control on the database
architecture because this is a customer's database (poor and old
existing database).
So, in this database, unfortunately, Name field is PK, and I have no
choice, I need to do a rename even if it is a PK.
Thanks.
Francois
Aristedes Maniatis wrote:
On 01/08/2008, at 10:05 PM, Francois Eyl wrote:
What I need is, to change the Name (PK) value of my object, and
here I need to change the Name in every related object. But I need
to do this on the same SQL transaction.
The question you'll probably get back from many people is: why are
you trying to change the PK of the object? That is supposed to be
the one immutable property of the object. If you are changing the
PK of existing objects in your database, you may need to rethink
your strategy. On the whole, avoid using meaningful data as the
primary key and your job will be much simpler. Cayenne gives you a
range of options to automatically create nearly sequential primary
keys.
Ari Maniatis
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
___________________________________________________
Ce message a ete verifie par l'antivirus de MDaemon 5 .
Par precaution, n'ouvrez pas de pieces jointes de correspondants
inconnus.
___________________________________________________