I'm assuming you can query the parent table after the insert and get the ID
from the result set, then use it in your child insert.

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> robert young
> Sent: Tuesday, April 10, 2001 6:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: OFF-TOPIC: using JDBC to update parent/child tables
>
>
> the problem, it seems, is getting that parent table id.  in COBOL/SQL or
> C/SQL it is possible to pass data from SQL into program variables.
> JDBC doesn't seem to support this.  so, after inserting the parent
> table row, how to find its ID (which is generated on the DB/SQL side
> of things, not the java class) so that i can write it into the child row?
>
> beating my head agin the wall,
> robert young
>
>
> > -----Original Message-----
> > From: A mailing list for discussion about Sun Microsystem's Java Servlet
> > API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Stephen Casey
> > Sent: Tuesday, April 10, 2001 8:53 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: OFF-TOPIC: using JDBC to update parent/child tables
> >
> >
> > You can create a connection object with auto commit turned off.
> Then pass
> > that connection along with your ParentTableID to the child
> update code as
> > session vars. When all updates to database are successful, commit all
> > transactions.
> >
> >
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to