Forums Register Login

Passing a DataSource from JNDI to my DAO through Session Bean

+Pie Number of slices to send: Send
Hi guys

I'm getting a DataSource through JNDI and passing that to my DAO to get a connection. This all happens inside a Stateless session bean. I was wondering, if some sort of error occurs during my database process(when I use my DAO), is transaction supported during this phase? I mean, would my transaction rollback?




Thanks!
+Pie Number of slices to send: Send
 

Originally posted by Timothy Sam:
if some sort of error occurs during my database process(when I use my DAO), is transaction supported during this phase?



Which transaction mechanism you are using? Anyway, you can do the dollowing:

1) Use CMT for the session bean method,
2) Put your bean method code in a try catch,
3) Throw exception from teh dao methods explicitly in case of issues / exception received,
4) In bean methods catch you can call setRollBackOnly on context object.

Hope this solves your problem.
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1849 times.
Similar Threads
Design: should I add a 'DAO' layer between my Session bean and my Entities?
ServeltContextListener for DataSource
Spring + AOP
how do i make a radio button to be checked when a page loads up?
DTO Setter Best Practises
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:58:09.