calling stored procedure from bmp


EJB programming & troubleshooting: calling stored procedure from bmp

  1. calling stored procedure from bmp (10 messages)

    Is there sample code availble for calling stored procedure from BMP. If we call stored procedure from stateless session bean can it support transaction?

    Threaded Messages (10)

  2. Hi,

    The syntax for calling a stored procedure will not be any different just because the call is being made from a BMP.
    It's the same
    CallableStatement cstmt =
                   connection.prepareCall("{ call xyzProcedure(?,?,?,?,?,?)}");
    and then define your IN/OUT params.

    About the transaction support.
    When you call a stored proc from an EJB, it is NOT a NESTED transaction just because the call has been made from a bean. When you start a transaction in the database using PL/SQL, it's like a new transaction and is out of the control of the EJB transacton.
    THerefore, in the event that the PL/SQL transaction rolls back, the EJB transaction would get commited, or the vice-versa. Simply put, there is no way for the EJB to rollback the transaction of the PL/SQL procedure.

    If you are really worried about maintaining the integrity of the transaction, move it all into one layer.

  3. BMP and stored procedure[ Go to top ]

    I think I can use calling stored procedure in getter and setter methods and normal prepared statements for load,store ,find by primary key etc. Am I Correct.
  4. BMP and stored procedure[ Go to top ]

    hi ashutosh,
    Yes you could do that...
    why do you need to use a stored proc for getter methods?
    Is there some real complex logic involved in retreiving the values?

  5. BMP and stored procedure[ Go to top ]

    Yes Preeti
    there is complex data base logic and XML parsing which I want to do in database itself.
    can u tell me how to do crash recovery for weblogic and error handling in my program.
  6. Failure recovery[ Go to top ]


    First the failure / crash recovery for Weblogic. Weblogicc itself provides features for failure recovery. Its quite exhaustive, so look it up on this link.
    When you say failure recovery, do you mean just the server, or are you also referring to recovery of application logic (in case of the latter, I'd need more details, but you would need to use Transactions to maintain integrity).
    Are you using a single server or a cluster?

    About error handling, I am not too sure what you mean, so if you could elaborate, it would be helpful.

  7. error handling[ Go to top ]

    I have to make a error handling mechanism for my appn. Myexception class will extend exception class and will ahve my own methods in it. I will send mails about errors using internalization. acn u throw some light on a good design.
  8. error handling[ Go to top ]

    What you can do is set up a separate notification framework. The responsibility of this module would be to recognize the error and send related error messages to the appropriate parties (assuming that different people recieve the error msgs depending on the type of error). If only the admin recieves all error msgs, this will make it simpler - it all depends on your application reqt.
    I have used the java mail API in the past for a similar requirement and it worked very smoothly.

    The interface to this notification framework should be a simple one - something like processError(error). When an error occurs, make a call such as notificationFacade.processError(error). You can even start this off in a separate thread; reason - any hold up in the mail queue should not effect your application. If this is going on inside a J2EE server, be careful about using threads.

    The advantage of using this approach would be that if you need to add any further functionality to your error handling, it can be done at a single point i.e. in the errorHandling framework.
    I have given a general overview here, let me know if you need any more info.

    I hope I have understood your question correctly or that was a lot of typing for nuttin ;)


    p.s. when u r posting any Q, give as much relevant info as possible - makes it easier for ppl to understand and u will get a lot of helpful responses.
  9. error handling[ Go to top ]

    u have understood my problem. can u elaborate it more. I also want to catch exception at top level. can u send me a explanation (lld) at kumar dot ashutosh at seepz dot tcs dot
  10. MDB for mails[ Go to top ]

    I need an architecture for sending mails. I have decided to use MDB and jms queue. Mail may me sent to a user or to role containg multiple user. I have to use internationlization also. can u suggest a architecture.where should I retrive information of user and role ?should I have multiple methods like sendmailToUser, sendmailToRole and I should retrive email ids of all persons in role from database and put it in a list?Can I use a method in MDB for accessing these info from database?
  11. MDB for mails[ Go to top ]

    i have worked on a very similar reqt. using i18n of msg contents, send to user/role etc. No MDB - we used EJB1.1
    I can't mail you the exact framework we developed (dont wanna get fired ;) but I will mail you how we went about it. How you want to incorporate that into MDB really depends on u..... jes curious - any particular reason for using MDB.
    Will mail you in a few hrs - bit busy today :(