We help IT Professionals succeed at work.

EJB 3 and DAO : Too much too migrate

handoyog
handoyog asked
on
1,042 Views
Last Modified: 2013-11-24
In my EJB3, I am still using my DAO instead of Persistence Manager
The DAO is just a POJO, lying under Session Bean

The problem is : The JDBC Connection does not seem to participate in a Transaction, even though The Method is already specified using @TransactionAttribute(REQUIRED)
So, it causes deadlock on parent child update

I tried to debug the Session Bean, but even the UserTransaction object can't be obtained via
InitialContext().lookup(java:comp/UserTransaction)
or Even from
UserTransaction ut = context.getUserTransaction()

ut will have TransactionHandlerImpl, with no actual UserTransaction object

Now,
I need to make DAO work with EJB 3 Transaction first. Upgrading DAO to EntityManager is scheduled next 12 months. Anyone know how can the Connection in JDBC participate in the Container Managed Transaction ?
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
For the Container, I am using Sun Java Application Server 9 (NetBeans 5.5) and OC4J 11 preview

The same EAR deployed in OC4J 11 did not encounter deadlock because it participate in Transaction

As for OC4J, I can't get it stop at the breakpoint I specify in NetBeans 5.5, even though it ran using -Xdebug, so I use it as secondary development container.

This is what I initially fear of using Annotation. We did not know how the container will specifically behave when it was working fine in EJB 2.1. I did not know for 3 days that the Transaction actually did not take place.

I also did not know if The Transaction Context is propagated only in the Session Bean ( in my problem ), or down to Session Bean Helper objects
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.