aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Invoke two stored proceedures parlally Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Invoke two stored proceedures parlally" Watch "Invoke two stored proceedures parlally" New topic
Author

Invoke two stored proceedures parlally

Anantha Reddy
Greenhorn

Joined: Jun 24, 2008
Posts: 12
Hi,

My application flow like below.

jsp->Controller->Action->ModuleSLEJB->SubModuleSLEJB->DAO>>oracleDB


My requirement is when I submit Jsp with some action , action class calls some business metod of ModuleSLEJB which inturn calles the bussiness method of SubModuleSLEJB which in turn call the actuval implementation method in corresponding DAO class.

what method supposed to do?

It invokes 2 stored procedures with some in params. each procedure takes 10-12 mins to complete its process, once done send mail to user.

> I have to invoke 2 procs paralally within 10 or 12 mins both will complete process.
> upon submit of jsp those 2 procs should get triggered with some in params, control has to return to jsp to show some message like 'procs are invoked you will get report by mail with in 10-15 mins' irrespective of proc state(finished/running state), should not wait till pros coplete execution.

can any one suggest how can I achive that... do i have to use MDBs for that, or do I need to invoke 2 seperate threads?..(using multi threading concept)... what are the pros and cons what could be the best solution for the requirement..

Please share your valuble inputs/suggestions ...

Thanks in advance.
Anantha

Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Anantha Reddy wrote:what are the pros and cons what could be the best solution for the requirement..


Are you asking w.r.t performance or in general? If this is not something specific to performance then i can move it to a more appropriate forum for you, where you can get better answers.


apigee, a better way to API!
Anantha Reddy
Greenhorn

Joined: Jun 24, 2008
Posts: 12
yeah!.. it is not releted to performence, it is bit complex and general requirement
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Just as a general comment, I've learned the hard way that stored procedures should only be used as a last resort. However, this sounds like it's probably one of them.

It appears that you're asking specifically about how to get this to work in a web application, where fast turnaround is important. While MDB's can be used to kick off long-running processes, probably they're not appropriate here. So most likely you want to run threads.

Running threads in a web application have certain rules and constraints, which I won't go into here (search the servlets and JSF forums for "null servlet" and/or "engine" and you should find some detailed discussions).


Customer surveys are for companies who didn't pay proper attention to begin with.
Anantha Reddy
Greenhorn

Joined: Jun 24, 2008
Posts: 12
Hey thanks for reply..

Yeah! we have implemented the requirement like below.

now we are calling one stored proc whic is a wrapper proc which does submit 2 jobs with 2 procs and return control immediatly irrespective of those 2 job states, and we will be able to show some message to used upon submission of form.

I would appriciate if you can share any idea of implementing the same using java with less turn around time, w.rt invoking/ calling 2 stored procs parlally on submission of form.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoke two stored proceedures parlally