File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Isolation for my EJB

 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 775
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic