Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

EJB 3 and DAO : Too much too migrate

Posted on 2007-10-05
4
Medium Priority
?
1,028 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 ?
0
Comment
Question by:handoyog
  • 2
4 Comments
 
LVL 23

Assisted Solution

by:Ajay-Singh
Ajay-Singh earned 1020 total points
ID: 20027125
> 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.
0
 
LVL 17

Assisted Solution

by:ram_0218
ram_0218 earned 480 total points
ID: 20028023
>> 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.
0
 

Author Comment

by:handoyog
ID: 20028095
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
0
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 1020 total points
ID: 20029390
> 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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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.

564 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