Hey!
I don't see why you can't do what you want.
But what I would check carefully whether you have any open statements or connections to
the
DB. I would completely close everything in A before doing B, and do your commits.
Sans adieu,
Danny Rubis
Pradeep Paudyal wrote:
> hi,
> I got into a very different and serious issue today.
> I have two tables A and B. I insert some data in table A and get the uniqueid of
> the row I just inserted from table A . I pass that uniqueid along with
> HttpServletRequest req as parameters to another method where it extracts some more
> info from HttpServlet Request req and inserts data in another table B.
> for example,
>
> public synchronized int method1( HttpServletRequest req )
> {
> String value1 = req.getParameter( "value1");
> String value2 = req.getParameter("value2");
> intuniqueid =
> SomeClass.callInsertingMethodtoTableA( value1, value2 );
> ( callInsertingMethodtoTableA method is static and
> synchronized ).
> method2( uniqueid, req );
> return uniqueid ;
> }
>
> public int method2( int uniqueid, HttpServletRequest req )
> {
>
> int someMoreValue1 = req.getParameter("someMoreValue1");
> int someMoreValue2 = req.getParameter("someMoreValue2");
>
> SomeClass.callInsertingMethodtoTableB( int uniqueid, someMoreValue1);
> SomeClass.callInsertingMethodtoTableB( int uniqueid, someMoreValue2);
> ( callInsertingMethodtoTableB method is
> static and synchronized ).
> }
>
> The problem I came across was this method2 is inserting values from other
> HttpServletRequest req.
> Like instead of just inserting those two rows with that uniqueid, its inserting
> more than two rows, other rows consisting of values from other request.
>
> Has anyone any idea why this is happening?
> I am hopeful that I can do the inserting into tableB inside the method1( by
> copying the code inside method2 and replacing the calling of method2 by these lines
> of codes, and then it may fix the problem. But I am wondering why this is happening
> which I think shoudln't happen.
> Any ideas , suggestions wlill be appreciated.
> Thanks
> Pradeep
>
> ___________________________________________________________________________
> 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