aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Isolation for my EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Isolation for my EJB" Watch "Isolation for my EJB" New topic
Author

Isolation for my EJB

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
I have an application using JDBC. But for some reasons 9we are using Singleton on DAO's) I cannot use the JDBC for manage the isolation (con.setTransactionIsolation(int)). So what can I do to solve this?

I'm using JBoss.

Thank's
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
The solution is probably to stop using the singleton pattern. Arguably the most over-used and misunderstood pattern in the GOF book. Somebody has ensured that you can't make dynamic configuration changes to your DAO without impacting somebody else. If the impact on others (e.g. in other threads of execution) is what you are trying to avoid while changing the transaction isolation level for your own use, unfortunately you are hosed.


Reid - SCJP2 (April 2002)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
How useful is it anyway to change the isolation level? For instance, I believe that Oracle only supports two levels: TRANSACTION_READ_COMMITED (the default) and TRANSACTION_SERIALIZABLE (which you won't normally want to use).


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Good point. The situation is a bit more complex if you are using something like Weblogic CMP even with Oracle, but for Dao's using JDBC directly, you are correct. There doesn't seem a good reason for mucking with that setting.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Do I understand you right that your architecture includes read-write Singletons accessed from EJBs? If that is the case your architecture is going against the EJB spec. I'd find out why Singletons are required - sounds a little strange to me.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
With sure the Singleton was not a good idea, but the project is runnning, so I cannot change now... hehehe
And the point is: I need to guarantee the isolation of transaction, I cannot admit data inconsistency. So I want to know what's the easily solution?

Humm, another thing: I'm using EJB CMP, so I cannot use JTA.
Another, I'm using the JBoss, I heard that don't have tools to manage isolation (WebLogic have)

Somebody have another idea? Or maybe I have a big problem here? hehehe
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
With sure the Singleton was not a good idea, but the project is runnning, so I cannot change now... hehehe

It's still not clear why you can't make a change.

Humm, another thing: I'm using EJB CMP, so I cannot use JTA.

All container-managed EJB transactions are JTA transactions.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Why did you change your display name Luciano?

"Pozzo"-
Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
[ January 16, 2006: Message edited by: Mark Spritzler ]

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Roger, we cannot change because we have a lot of things using and we have a short time of delivery the product.

About the second question, I said about explicity JTA code inside of my Session Bean method.

So, can you list all the possibilities that you know to serialize my method access or maybe my DAO methods?

thank-you for the interest.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Isolation for my EJB