Hi John, thanks. Actually I have already added the sequence manager to the 
jdbc-connection-descriptor, and also the settings for the primary key.
 
So are you saying that my reference-descriptor in the Parent table needs to be removed 
and instead add it to my child table? If not then, what do you mean. :)
 
Thanks
 
Mark

"McCaffrey, John G." <[EMAIL PROTECTED]> wrote:
Search the archives for SequenceManger and Idenity threads.

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


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]



Franziska says, "Keep eating healthy"

she also says that the above line is not actually gramatically correct. 

She wants you all to know that healthy cannot be there; it really should be an adverb 
like healthfully.

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

Reply via email to