Search the archives for SequenceManger and Idenity threads.

Here is what I needed to do:
add a sequence manager to my jdbc-connection-descriptor
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">
</sequence-manager>     

Make sure these were set on my primary key
     primarykey="true"
     autoincrement="true"
     access="readonly"

Then I had to flip my mapping because I had
Parent > contains a reference to a single Child (not a collection)
but OJB wants Child > contains reference to Parent

HTH

-----Original Message-----
From: Mark Spritzler [mailto:[EMAIL PROTECTED]
Sent: Friday, May 07, 2004 4:05 PM
To: [EMAIL PROTECTED]
Subject: Child Table insert at same time as Parent and Auto generated PK


I am using MySql.
 
OK. I have a Parent-Child relationship which is 1:1 relationship. I am
inserting into each table at the same time. Obviously, the Parent gets
inserted first. But the Primary Key is auto-generated by MySQL in an
auto-generated field. So when the child record gets inserted, I need that
newly created ID to be in the child record. But it isn't getting it, and the
ID in the child is Null, so the Database returns an error for it being Null.
 
Does anyone know a way to fix this problem? Putting the child fields into
the Parent table is not a possibility and wouldn't be a good db design
decision.
 
Thanks everyone
 
Mark

                
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to