Stateless EJB calling stored procedures

V

veera maria

Hi,
I have a following situation. I should make stateless session bean as
a interface to stored procedures which are stored in database. Session
bean should call one stored procedure and that procedure might call
also another stored procedure to handle database actions and then
return resultset to session bean.

So, my questions are:
- is stateless session bean suitable for this kind of usage?
- session bean should handle transactions, so what kind of transaction
type
it should use? Some that is handled by container or JTA based?
- as I mentioned, there could be a 'chain' of stored procedure calls
after
session bean has called the first stored procedure, so can session
bean's transaction type handle this kind of chained stored procedure
calls or how to handle commits or rollbacks?

Br

Vera
 
S

Sudsy

veera said:
Hi,
I have a following situation. I should make stateless session bean as
a interface to stored procedures which are stored in database. Session
bean should call one stored procedure and that procedure might call
also another stored procedure to handle database actions and then
return resultset to session bean.

So, my questions are:
- is stateless session bean suitable for this kind of usage?
Certainly.

- session bean should handle transactions, so what kind of transaction
type
it should use? Some that is handled by container or JTA based?

I would obtain a javax.transaction.UserTransaction, typically
via JNDI lookup.
- as I mentioned, there could be a 'chain' of stored procedure calls
after
session bean has called the first stored procedure, so can session
bean's transaction type handle this kind of chained stored procedure
calls or how to handle commits or rollbacks?

Invoke begin() on the UserTransaction and then invoke your methods
within a try block. If an Exception is thrown then invoke rollback()
on the UserTransaction else invoke commit(). Everything should then
be appropriately handled by JTA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top