EJB 3 and DAO : Too much too migrate

Posted on 2007-10-05
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
or Even from
UserTransaction ut = context.getUserTransaction()

ut will have TransactionHandlerImpl, with no actual UserTransaction object

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 ?
Question by:handoyog
    LVL 23

    Assisted Solution

    > Anyone know how can the Connection in JDBC participate in the Container
    Managed Transaction ?
    The implementation lies with the container. So, you should look at the
    container's code. Which container are you using here? and remember any
    changes you will do will make your code container specific - will be
    difficult to migrate to different container.
    LVL 17

    Assisted Solution

    >> Anyone know how can the Connection in JDBC participate in the Container Managed Transaction

    as far as i think you cant customize the vendor code.

    Author Comment

    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
    LVL 23

    Accepted Solution

    > This is what I initially fear of using Annotation.
    I really doubt annotation is the cause. If you feel that is, then remove all
    the annotation and you can still use plain old xml descriptors. There is a
    lot of change in EJB 2 to EJB 3.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
    This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now