Hi,
I'm using Cayenne to persist an object graph across 2 tables (Org, Member).
The Org table has a 1-many relationship with Member. The member table has a
FK relationship (parentId) back to the Org table.
When I'm doing the initial insert, I first create the Cayenne object
representing Org. I then iterate through and create all of the Member
objects, adding each to the Member array on the Org object, and setting the
Member.parentId to be the primary key of the Org object.
Once everything is created, I then commit the changes.
The problem I'm running into is a violation of the FK constraint setup on
the Member table (back to the primary key of Org). When I looked at the
Cayenne logs, what I noticed is that the inserts for the Member table are
happening before the insert for the Org table.
I'm going to see if I can find a way to defer the constraint evaluation to
transaction commit on MySQL (I've done this for Oracle before), but what I'm
wondering is if there is any way to influence the order of the inserts. I'd
prefer to have the Org row inserted first, followed by all the Member rows.
Thanks!
Greg
Greg Newton
Chief Architect, Enhanced Services
Z-Tel Communications, Inc.
<http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=3340+Peachtree+Rd.+NE&csz=At
lanta%2C+GA+30326&country=us> 3340 Peachtree Rd. NE
Suite 2000
Atlanta, GA 30326
<mailto:gpnewto..-TEL.com> gpnewton@Z-TEL.com
tel:
404-504-0928
This archive was generated by hypermail 2.0.0 : Thu Jul 08 2004 - 22:17:04 EDT