OCJ4's EJB transaction isolation level
Hello, all
Does OC4J supports various transaction isolation level?
I am using JDeveloper to create and deploy
EJBs and all I can find is transaction attributes,
and not isolation level. The book I am currently reading
suggests that there's tx isolation setting in BEA
WebLogic.
If anybody has found a way to do this in OC4J + Jdeveloer,
or if it is ever required, let me know.
Thanks
Hi
You can specify the isolation level using the "isolation" attribute of the "entity-deployment" tag.
Ex:
<entity-deployment name="MyEJB" isolation="serializable">
Go through the DTD for details :
http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd
--Shrini
Similar Messages
-
Transaction Isolation Level for EJB methods
L.S.
I just found out the in OC4J one can not set the transaction isolation level on ejb methods. Moreover one needs to revert to bean managed transaction (manual coding of the ALL transaction logic) to set the isolation level.
On entity beans one can only set the isolation level for the whole bean (not on individual methods), and in session beans there is no way at all to set the isolation level.
This is on shear contract to all other application servers I used before (there one can declaratively set the isolation level for a ejb method, both in session and in entitybean deployment descriptors)
Is it foreseen in a future release to include such a valuable feature will be provided by oc4j?
Note that I was VERY surprised that OC4J could not handle this (I checked the j2ee spec, but admittedly the spec is a little vague about this support and makes it vendor dependent. the j2ee spec does not mandate this, except for CMP entity beans, but includes some suggestions on this ability. But most other application servers implemented the ability)
Regadrs,
ErikHello Erik --
I think we met in Perth recently?
Anyway, your information is correct.
We can set the transaction isolation level for each entity bean, at the bean level. We don't have for the specification of method level isolation settings -- I'd be interested to hear how you would like/do use this. What behaviour do you expect to see when a transaction is started that spans multiple methods on a bean with different declared isolation levels.
For session beans, we do not currently have the ability to declaratively specify the isolation level to use for the bean. I know this is not in the forthcoming 904 release, and will to check what is beyond that.
As you point out, this can be done programatically using the Connection.setIsolationLevel() method on any connections you are using from within the session bean.
I'd would like to log an enhancement request for you for this functionality. Can you send me an email at [email protected] and we'll take it offline.
-steve- -
Transaction Isolation Levels in weblogic-cmp-rdbms-jar.xml
Hi All,
Iam using ejb 1.1 specification with weblogic 5.1. We can set the transaction
isolation levels for the methods in the
weblogic-ejb-jar.xml. There is also a provision for setting this isolation level
in the weblogic-cmp-rdbms-jar.xml. Now is there any difference between setting
the isolation levels in these two ways.
Help me asap.The CMP setting has been deprecated. You can set it for all types of
EJBs in the weblogic-ejb-jar.xml
-- Rob
chandru wrote:
Hi All,
Iam using ejb 1.1 specification with weblogic 5.1. We can set the transaction
isolation levels for the methods in the
weblogic-ejb-jar.xml. There is also a provision for setting this isolation level
in the weblogic-cmp-rdbms-jar.xml. Now is there any difference between setting
the isolation levels in these two ways.
Help me asap. -
Locking issues with transaction-isolation levels
I believe that my program is suffering from some sort of deadlock, and I was hoping
for some feedback.
I am helping to develop a trading system
using EJBs, Oracle 9i, and Bea Weblogic 7.0. The system provides an entity EJB
called LiveOrder that exposes several finder methods, most of which return java.util.Collections
of LiveOrder EJBs.
In weblogic-ejb-jar.xml, I have set the transaction isolation-levels for these
finders to TRANSACTION_READ_COMMITTED_FOR_UPDATE (b/c TRANSACTION_SERIALIZABLE
isn't really supported by Oracle), in an effort to eliminate phantom reads, which
occur frequently if I do not use this isolation level. These finders all use transaction
attribute 'Required'.
It is my understanding that any transaction that calls any of these finders either
will lock the database if no other transaction already owns the lock, or will
wait until the lock is released if another transaction owns that lock. It also
is my understanding that a transaction that owns a lock will always release any
locks acquired upon expiration of that transaction (whether that be via commit
or via rollback).
However, this doesn't always appear the case: I have noticed occassionally that
several clients "hang," as they wait for the lock that, for some reason, is not
being released by its transaction. There do not appear to be any exceptions thrown
by the system prior to the system hanging, and the Weblogic administration tool
states that all transactions have been committed.
If it helps, I have included the general algorithm for the main (i.e., most expensive)
transaction:
1. a client calls a stateless session EJB's processOrder method (which should
implicitly start a new transaction, b/c this method has attibute 'RequiresNew')
2. the transaction invokes the LiveOrder finder method (this should lock the DB,
so subsequent callers should block until the lock is released).
3. the transaction invokes another LiveOrder finder method, returning a separate
set of data.
4. the transaction invokes a finder method from a separate entity EJB (called
Security), which maps to a "read-only" table in the DB (default transaction-isolation
level, Required attribute).
5. the transaction invokes a finder method from yet another separate entity EJB
(called SecurityMarketValues), which maps to some other table (not read-only)
in the DB (again, default transaction-isolation level, Required attribute).
6. the transaction writes to the SecurityMarketValues entity EJB.
7. the transaction writes to the LiveOrders retrieved from steps 2 and 3.
8. the transaction ends by exiting method processOrder (thus releasing the locks
on the LiveOrder table in the DB).
In the system, there also exist other transactions that occassionally call the
LiveOrder EJB finder methods, but only briefly to take a "snapshot" of the live
order table (i.e., these transactions do not make calls to other DB tables, and
close transactions almost immediately after starting them)
Like I mentioned before, the system sometimes works, and sometimes it hangs. Any
ideas? I'm running out...
Jon,
If there was an Oracle deadlock the DB would resolve it momentarily and
will ultimately choose one transaction and throw an exception so it's
not a DB deadlock.
Take a thread dump at the very moment your system seems to be hanging
and look at what the threads are doing.
From your description it's not very unlikely that those threads of
yours that take snapshots of the data will not disrupt the transactions
so you may be surprised by the thread dumps that this is actually what
happens -- those snapshot thread wait for some lock while holding locks
needed by you other threads and it just slows down the system.
Regards,
Dejan
Jon Gadzik wrote:
>I believe that my program is suffering from some sort of deadlock, and I was hoping
>for some feedback.
>
>I am helping to develop a trading system
>using EJBs, Oracle 9i, and Bea Weblogic 7.0. The system provides an entity EJB
>called LiveOrder that exposes several finder methods, most of which return java.util.Collections
>of LiveOrder EJBs.
>
>In weblogic-ejb-jar.xml, I have set the transaction isolation-levels for these
>finders to TRANSACTION_READ_COMMITTED_FOR_UPDATE (b/c TRANSACTION_SERIALIZABLE
>isn't really supported by Oracle), in an effort to eliminate phantom reads, which
>occur frequently if I do not use this isolation level. These finders all use transaction
>attribute 'Required'.
>
>It is my understanding that any transaction that calls any of these finders either
>will lock the database if no other transaction already owns the lock, or will
>wait until the lock is released if another transaction owns that lock. It also
>is my understanding that a transaction that owns a lock will always release any
>locks acquired upon expiration of that transaction (whether that be via commit
>or via rollback).
>
>However, this doesn't always appear the case: I have noticed occassionally that
>several clients "hang," as they wait for the lock that, for some reason, is not
>being released by its transaction. There do not appear to be any exceptions thrown
>by the system prior to the system hanging, and the Weblogic administration tool
>states that all transactions have been committed.
>
>If it helps, I have included the general algorithm for the main (i.e., most expensive)
>transaction:
>
>1. a client calls a stateless session EJB's processOrder method (which should
>implicitly start a new transaction, b/c this method has attibute 'RequiresNew')
>
>2. the transaction invokes the LiveOrder finder method (this should lock the DB,
>so subsequent callers should block until the lock is released).
>
>3. the transaction invokes another LiveOrder finder method, returning a separate
>set of data.
>
>4. the transaction invokes a finder method from a separate entity EJB (called
>Security), which maps to a "read-only" table in the DB (default transaction-isolation
>level, Required attribute).
>
>5. the transaction invokes a finder method from yet another separate entity EJB
>(called SecurityMarketValues), which maps to some other table (not read-only)
>in the DB (again, default transaction-isolation level, Required attribute).
>
>6. the transaction writes to the SecurityMarketValues entity EJB.
>
>7. the transaction writes to the LiveOrders retrieved from steps 2 and 3.
>
>8. the transaction ends by exiting method processOrder (thus releasing the locks
>on the LiveOrder table in the DB).
>
>
>In the system, there also exist other transactions that occassionally call the
>LiveOrder EJB finder methods, but only briefly to take a "snapshot" of the live
>order table (i.e., these transactions do not make calls to other DB tables, and
>close transactions almost immediately after starting them)
>
>Like I mentioned before, the system sometimes works, and sometimes it hangs. Any
>ideas? I'm running out...
>
>
>
>
-
Setting transaction isolation levels in WAS5
I think I'm missing something pretty easy. How can I set the isolation
levels for the containter managed transactions on my beans?
Specifically, I want to set soem lookup methods on my Sessions beans
to TRANSACTION_REPEATABLE_READ. I've already put the
container-transaction blocks in my ejb-jar.xml
Does Websphere 5 have something akin to WebLogic's
weblogic-ejb-jar.xml where you can set additional parameters like
this? Do I have to use a tool like WSAD to specify this? The AAT
doesn't seem to have this option.
Thanks,
James LynnHi Slava, Ryan,
We haven't looked at 8.1 yet since our release cycle wouldn't allow us
to move to 8.1 until at least June anyway, but even if the problems was
fixed there it took BEA support more than 6 months (I opened the case on
Sep 23 2002 and only this week I got the patch that I haven't even tried
to test to see if it works) to issue a patch for such a small problem.
The server would just check if the Oracle XA driver was being used and
no matter what version would just throw an exception if you try to set
the transaction isolation level saying that the feature in the Oracle
8.1.7 driver was broken... (although you might be using 9.x or even a
pre-8.1.7 driver)...
So this is about it.
And Slava, I've tried pushing a case harder only to end up with BEA
support trying to convince me that I was misinterpreting the JDBC spec
when it was not true, so I just gave up. The main goal of BEA support in
all of our experience has been that they don't try to solve the cases
but close them.
That's my and some of my colleagues personal views anyway, you don't
have to share them.
Regards,
Dejan
Slava Imeshev wrote:
Hi Deyan,
Sorry for the delay. Could you give us more details about CR090104?
I've got some feedback in XA area, not sure if it was a related case.
Also, I've never had any problems with weblogic CCE, so you may want
to push your case a little harder.
As per the bold statement - the initial question was about functionality
available in weblogic but not available in websphere - it can't be more
bold :)
Regards,
Slava Imeshev
"Deyan D. Bektchiev" <[email protected]> wrote in message
news:[email protected]...
This is a very bold statement Slava, considering that with Oracle XA
driver you cannot even set the transaction isolation level because of a
Weblogic bug (CR090104 that has been open for more than 6 months
already)...
Dejan
Slava Imeshev wrote:
Hi James,
"James F'jord Lynn" <[email protected]> wrote in message
news:[email protected]...
I think I'm missing something pretty easy. How can I set the isolation
levels for the containter managed transactions on my beans?
Specifically, I want to set soem lookup methods on my Sessions beans
to TRANSACTION_REPEATABLE_READ. I've already put the
container-transaction blocks in my ejb-jar.xml
Does Websphere 5 have something akin to WebLogic's
weblogic-ejb-jar.xml where you can set additional parameters like
this? Do I have to use a tool like WSAD to specify this? The AAT
doesn't seem to have this option.
My guess here is that it's a signal that this is a last chance
for you to abandon WebSphere and return back to WebLogic's
safe harbor.
Regards,
Slava Imeshev -
How to change the transaction isolation level of a CMP?
How to change the transaction isolation level of a CMP from SUN's Deployment Tool? So far I can't find any entry for this setting.
Anuradha W wrote:
That means, currently the only way tospecify the transaction level is through
weblogic-ejb-jar.xml deployment descriptor?
for WLS-generated code, yes.Somewhat related to this question, we have written a standalone testcase to reproduce this issue we have been having. Basically, the issue is that even though we configure the isolation level to a non-default one in the deployment descriptor, the connections returned by the datasource seem to be having the default (which is Read Committed). The DBMS is DB2.
weblogic-ejb-jar.xml has the following set:
<isolation-level>TransactionRepeatableRead</isolation-level>
And we printed the isolation level of the connection returned from a method in the EJB, but the isolation level is still the default. I can share the code to reproduce the problem if you want to take a look at it. Please let me know how I can get that across to you.
Thanks,
AnuradhaIf you are using our JDBC driver for DB2, or can switch to it,
just for a test, there is some debug I'd like from you.
Joe -
How to Set the Transaction Isolation Level in WebLogic?
Is there a way to set the transaction isolation level in WebLogic 9.2 or WebLogic 10?
For an example say, we have an application which is supported for several database platforms. Without setting the transaction isolation level in DBMS level, is there a way to specify this in WebLogic to make it common for all the DBMS type?
And I found a way to change the transaction isolation level in WebSphere application server using a property called webSphereDefaultIsolationLevel.
[url http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg21224492]http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg21224492
Is there a way to do the same thing in WebLogic application server 9.2 or 10?Anuradha W wrote:
That means, currently the only way tospecify the transaction level is through
weblogic-ejb-jar.xml deployment descriptor?
for WLS-generated code, yes.Somewhat related to this question, we have written a standalone testcase to reproduce this issue we have been having. Basically, the issue is that even though we configure the isolation level to a non-default one in the deployment descriptor, the connections returned by the datasource seem to be having the default (which is Read Committed). The DBMS is DB2.
weblogic-ejb-jar.xml has the following set:
<isolation-level>TransactionRepeatableRead</isolation-level>
And we printed the isolation level of the connection returned from a method in the EJB, but the isolation level is still the default. I can share the code to reproduce the problem if you want to take a look at it. Please let me know how I can get that across to you.
Thanks,
AnuradhaIf you are using our JDBC driver for DB2, or can switch to it,
just for a test, there is some debug I'd like from you.
Joe -
How to set Transaction isolation level in Weblogic 11g
How do I set the transaction isolation level in Weblogic?
Some references that I found suggest that I have to explicitely state the isolation level in the weblogic-ejb-jar.xml per ejb. If I am using EJB 3.0 why would I need to do that?
Can I set this up as a property in the JDBC datasource setup?
Other application servers like Websphere actually allows for this. Can this be done in Weblogic?
Currently I get the following message if I don't set the isolation level:
Transaction attribute: TX_NOT_SUPPORTED Isolation Level: No Isolation Level Set Tx Timeout: 30000
What seems to be happening is that one update of my transaction is getting rolled back and other consequent calls are failing due to foreign key issues due to the first rollback.
I think the issue is related to the isolation level or the transaction time out being too low.
Any ideas?
BTW: I am using openjpa and using a MS SQLServer. Not sure if that helps the discussion.
Thanks
Edited by: rrivera on Jun 2, 2010 9:18 AMHow do I set the transaction isolation level in Weblogic?
Some references that I found suggest that I have to explicitely state the isolation level in the weblogic-ejb-jar.xml per ejb. If I am using EJB 3.0 why would I need to do that?
Can I set this up as a property in the JDBC datasource setup?
Other application servers like Websphere actually allows for this. Can this be done in Weblogic?
Currently I get the following message if I don't set the isolation level:
Transaction attribute: TX_NOT_SUPPORTED Isolation Level: No Isolation Level Set Tx Timeout: 30000
What seems to be happening is that one update of my transaction is getting rolled back and other consequent calls are failing due to foreign key issues due to the first rollback.
I think the issue is related to the isolation level or the transaction time out being too low.
Any ideas?
BTW: I am using openjpa and using a MS SQLServer. Not sure if that helps the discussion.
Thanks
Edited by: rrivera on Jun 2, 2010 9:18 AM -
How to set transaction isolation level for a method in a Local Interface
By reference at:
http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
the value for method-intf can only be "Remote" or "Home".
My question is--
How to set transaction isolation level for a method inside a Local Interface or
Local_Home Interface?
Thanks.
Xing
I'd try 6.1SP2. I'm pretty sure this works now.
-- Rob
Xing wrote:
> I tried "Local", but got an error when deploying the EJB jar, saying that only
> "Remote" or "Home" is allowed.
>
> Any idea?
>
> Xing
>
> Rob Woollen <[email protected]> wrote:
> >
> >
> >Use LocalHome or Local.
> >
> >-- Rob
> >
> >Xing wrote:
> >
> >> By reference at:
> >> http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
> >> the value for method-intf can only be "Remote" or "Home".
> >>
> >> My question is--
> >>
> >> How to set transaction isolation level for a method inside a Local
> >Interface or
> >> Local_Home Interface?
> >>
> >> Thanks.
> >>
> >> Xing
> >
> >--
> >
> >----------------------------------------------------------------------
> >
> >AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
> >
> >by Michael Girdley, Rob Woollen, and Sandra Emerson
> >
> >http://learnWebLogic.com
> >
> >
> >
> >
> ><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> ><html>
> >Use LocalHome or Local.
> ><p>-- Rob
> ><p>Xing wrote:
> ><blockquote TYPE=CITE>By reference at:
> ><br>http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
> ><br>the value for method-intf can only be "Remote" or "Home".
> ><p>My question is--
> ><p>How to set transaction isolation level for a method inside a Local
> >Interface
> >or
> ><br>Local_Home Interface?
> ><p>Thanks.
> ><p>Xing</blockquote>
> >
> ><pre>--
> >
> >----------------------------------------------------------------------
> >
> >AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
> >
> >by Michael Girdley, Rob Woollen, and Sandra Emerson
> >
> >http://learnWebLogic.com</pre>
> > </html>
> >
> >
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com
[att1.html]
-
Why encounter errors while setting transaction isolation level?
When attempting to set the transaction isolation level within an EJB, I encountered the following exception from the server log:
===========================================================
[#|2006-05-30T15:08:45.906+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
Enter ejbCreate( 100, Duke, Earl, 0.00 ):|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
List of Supported Transaction Isolation Levels: |#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
TRANSACTION_READ_UNCOMMITTED is supported!|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
TRANSACTION_READ_COMMITTED is supported!|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
TRANSACTION_REPEATABLE_READ is supported!|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
TRANSACTION_SERIALIZABLE is supported!|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
1. |#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|Transaction Status: |#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|TRANSACTION_READ_COMMITTED|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=25;|
con.isReadOnly() = false|#]
[#|2006-05-30T15:08:45.937+0800|WARNING|sun-appserver-pe8.1_02|javax.enterprise.system.stream.err|_ThreadID=25;|
SQLException: java.sql.SQLException: Transaction manager errors. statement not allowed in XA session.|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=25;|EJB5018: An exception was thrown during an ejb invocation on [SavingsAccountBean]|#]
[#|2006-05-30T15:08:45.937+0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=25;|
javax.ejb.EJBException: ejbCreate: Unable to connect to database. Transaction manager errors. statement not allowed in XA session.
at SavingsAccountBean.ejbCreate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:170)
at $Proxy60.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)
|#]===========================================================
But from the above log messages, all transcation isolation levels are supported. The relevant source codes are:
/*********************** Database Routines *************************/
private void makeConnection() {
try {
InitialContext ic = new InitialContext();
DataSource ds = ( DataSource )ic.lookup( dbName );
con = ds.getConnection();
DatabaseMetaData dmd = con.getMetaData();
show_supported_trans_levels( dmd );
int status = con.getTransactionIsolation();
System.out.print( "1. " );
disp_tx_status( status );
System.out.println( "con.isReadOnly() = " + con.isReadOnly() );
con.setTransactionIsolation( Connection.TRANSACTION_SERIALIZABLE );
System.out.print( "2. " );
disp_tx_status( status );
} catch( SQLException ex ) {
System.err.println( "SQLException: " + ex.toString() );
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
} catch( NamingException ex ) {
System.err.println( "NamingException: " + ex.toString() );
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
private void disp_tx_status( int status )
System.out.print( "Transaction Status: " );
switch( status )
case( Connection.TRANSACTION_READ_UNCOMMITTED ):
System.out.println( "TRANSACTION_READ_UNCOMMITTED" );
break;
case( Connection.TRANSACTION_READ_COMMITTED ):
System.out.println( "TRANSACTION_READ_COMMITTED" );
break;
case( Connection.TRANSACTION_REPEATABLE_READ ):
System.out.println( "TRANSACTION_REPEATABLE_READ" );
break;
case( Connection.TRANSACTION_SERIALIZABLE ):
System.out.println( "TRANSACTION_SERIALIZABLE" );
break;
case( Connection.TRANSACTION_NONE ):
System.out.println( "TRANSACTION_NONE" );
break;
default:
System.out.println( "UNKNOWN" );
break;
Who can help me?Try the following forum (about EJB technology)
http://forum.java.sun.com/forum.jspa?forumID=13 -
Transaction Isolation level in WebSphere and JBOSS???
Hi,
How to set up the transaction isolation level in Websphere and JBOSS???
In weblogic, we can set it in weblogic-ejb-jar.xml. Is there any other file where we can set the isolation level in websphere and jboss???
What is the difference between all the 4 isolation levels such as
1) Transaction_committed
2) Transaction_uncommitted
3)Transaction_Repeatable_read
4)Transaction_serializable
Thanks,
JavaCrazyLoverIn WebSphere 5.1 you can set the isolation level using resource reference. The following link describes the steps involved in this operation. I am not aware how to do the same thing in JBoss.
Regards,
Neo -
What is ths default transaction isolation level
Hi ,
If transaction isolation , for a EJB is not specified what is the
default transaction isolation level
Thanks
Jay
serializable
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"mrityunjay" <[email protected]> wrote in message
news:3a86c781$[email protected]..
> Hi ,
> If transaction isolation , for a EJB is not specified what is the
> default transaction isolation level
> Thanks
> Jay
>
>
-
Why can't I change the transaction isolation level?
I was trying to change the transaction isolation level from an EJB. My source codes are shown as the follows:
======================================================
/*********************** Database Routines *************************/
private void makeConnection() {
try {
InitialContext ic = new InitialContext();
DataSource ds = ( DataSource )ic.lookup( dbName );
con = ds.getConnection();
DatabaseMetaData dmd = con.getMetaData();
show_supported_trans_levels( dmd );
int status = con.getTransactionIsolation();
System.out.print( "1. " );
disp_tx_status( status );
System.out.println( "con.isReadOnly() = " + con.isReadOnly() );
con.setTransactionIsolation( Connection.TRANSACTION_SERIALIZABLE );
System.out.print( "2. " );
disp_tx_status( status );
} catch( SQLException ex ) {
System.err.println( "SQLException: " + ex.toString() );
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
} catch( NamingException ex ) {
System.err.println( "NamingException: " + ex.toString() );
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
private void disp_tx_status( int status )
System.out.print( "Transaction Status: " );
switch( status )
case( Connection.TRANSACTION_READ_UNCOMMITTED ):
System.out.println( "TRANSACTION_READ_UNCOMMITTED" );
break;
case( Connection.TRANSACTION_READ_COMMITTED ):
System.out.println( "TRANSACTION_READ_COMMITTED" );
break;
case( Connection.TRANSACTION_REPEATABLE_READ ):
System.out.println( "TRANSACTION_REPEATABLE_READ" );
break;
case( Connection.TRANSACTION_SERIALIZABLE ):
System.out.println( "TRANSACTION_SERIALIZABLE" );
break;
case( Connection.TRANSACTION_NONE ):
System.out.println( "TRANSACTION_NONE" );
break;
default:
System.out.println( "UNKNOWN" );
break;
private void show_supported_trans_levels( DatabaseMetaData dmd ) throws SQLException
System.out.println( "List of Supported Transaction Isolation Levels: " );
if( dmd.supportsTransactionIsolationLevel( Connection.TRANSACTION_READ_UNCOMMITTED ) )
System.out.println( "TRANSACTION_READ_UNCOMMITTED is supported!" );
else
System.out.println( "TRANSACTION_READ_UNCOMMITTED is unsupported!" );
if( dmd.supportsTransactionIsolationLevel( Connection.TRANSACTION_READ_COMMITTED ) )
System.out.println( "TRANSACTION_READ_COMMITTED is supported!" );
else
System.out.println( "TRANSACTION_READ_COMMITTED is unsupported!" );
if( dmd.supportsTransactionIsolationLevel( Connection.TRANSACTION_REPEATABLE_READ ) )
System.out.println( "TRANSACTION_REPEATABLE_READ is supported!" );
else
System.out.println( "TRANSACTION_REPEATABLE_READ is unsupported!" );
if( dmd.supportsTransactionIsolationLevel( Connection.TRANSACTION_SERIALIZABLE ) )
System.out.println( "TRANSACTION_SERIALIZABLE is supported!" );
else
System.out.println( "TRANSACTION_SERIALIZABLE is unsupported!" );
=========================================================
However, I encountered the following exception when running at the highlighted statement:
======================================================
SQLException: java.sql.SQLException: Transaction manager errors. statement not allowed in XA Session.
======================================================
To my surprise, the isolation level TRANSACTION_SERIALIZABLE is supported from the database vendor. So why can't I change the transaction isolation level?You can change the setting, you may need to click the lock at the bottom of the preference pane. Be careful what you download and install, Gatekeeper is there to help you. OS X: About Gatekeeper - Apple Support
-
Bug in Oracle's handling of transaction isolation levels?
Hello,
I think there is a bug in Oracle 9i database related to serializable transaction isolation level.
Here is the information about the server:
Operating System: Microsoft Windows 2000 Server Version 5.0.2195 Service Pack 2 Build 2195
System type: Single CPU x86 Family 6 Model 8 Stepping 10 GenuineIntel ~866 MHz
BIOS-Version: Award Medallion BIOS v6.0
Locale: German
Here is my information about the client computer:
Operaing system: Microsoft Windows XP
System type: IBM ThinkPad
Language for DB access: Java
Database information:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
The database has been set up using the default settings and nothing has been changed.
To reproduce the bug, follow these steps:
1. Create a user in 9i database called 'kaon' with password 'kaon'
2. Using SQL Worksheet create the following table:
CREATE TABLE OIModel (
modelID int NOT NULL,
logicalURI varchar (255) NOT NULL,
CONSTRAINT pk_OIModel PRIMARY KEY (modelID),
CONSTRAINT logicalURI_OIModel UNIQUE (logicalURI)
3. Run the following program:
package test;
import java.sql.*;
public class Test {
public static void main(String[] args) throws Exception {
java.util.Locale.setDefault(java.util.Locale.US);
Class.forName("oracle.jdbc.OracleDriver");
Connection connection=DriverManager.getConnection("jdbc:oracle:thin:@schlange:1521:ORCL","kaon","kaon");
DatabaseMetaData dmd=connection.getMetaData();
System.out.println("Product version:");
System.out.println(dmd.getDatabaseProductVersion());
System.out.println();
connection.setAutoCommit(false);
connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
int batches=0;
int counter=2000;
for (int outer=0;outer<50;outer++) {
for (int i=0;i<200;i++) {
executeUpdate(connection,"INSERT INTO OIModel (modelID,logicalURI) VALUES ("+counter+",'start"+counter+"')");
executeUpdate(connection,"UPDATE OIModel SET logicalURI='next"+counter+"' WHERE modelID="+counter);
counter++;
connection.commit();
System.out.println("Batch "+batches+" done");
batches++;
protected static void executeUpdate(Connection conn,String sql) throws Exception {
Statement s=conn.createStatement();
try {
int result=s.executeUpdate(sql);
if (result!=1)
throw new Exception("Should update one row, but updated "+result+" rows, query is "+sql);
finally {
s.close();
The program prints the following output:
Product version:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Batch 0 done
Batch 1 done
java.lang.Exception: Should update one row, but updated 0 rows, query is UPDATE OIModel SET logicalURI='next2571' WHERE modelID=2571
at test.Test.executeUpdate(Test.java:35)
at test.Test.main(Test.java:22)
That is, after several iterations, the executeUpdate() method returns 0, rather than 1. This is clearly an error.
4. Leave the database as is. Replace the line
int counter=2000;
with line
int counter=4000;
and restart the program. The following output is generated:
Product version:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Batch 0 done
Batch 1 done
java.sql.SQLException: ORA-08177: can't serialize access for this transaction
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:796)
at test.Test.executeUpdate(Test.java:33)
at test.Test.main(Test.java:22)
This is clearly an error - only one transaction is being active at the time, so there is no need for serialization of transactions.
5. You can restart the program as many times you wish (by chaging the initial counter value first). The same error (can't serialize access for this transaction) will be generated.
6. The error doesn't occur if the transaction isolation level isn't changed.
7. The error doesn't occur if the UPDATE statement is commented out.
Sincerely yours
Boris MotikI have a similar problem
I'm using Oracle and serializable isolation level.
Transaction inserts 4000 objects and then updates about 1000 of these objects.
Transactions sees inserted objects but cant update them (row not found or can't serialize access for this transaction are thrown).
On 3 tries for this transaction 1 succeds and 2 fails with one of above errors.
No other transactions run concurently.
In read commited isolation error doesn't arise.
I'm using plain JDBC.
Similar or even much bigger serializable transaction works perfectly on the same database as plsql procedure.
I've tried oci and thin (Oracle) drivers and oranxo demo (i-net) driver.
And this problems arises on all of this drivers.
This problem confused me so much :(.
Maby one of Oracle users, developers nows cause of this strange behaviour.
Thanx for all answers. -
Setting transaction isolation level in a session bean
Hi all!
In a stateless session bean (EJB3) with container managed transactions I need to set the transaction isolation level to SERIALIZABLE.
The idea is to prevent lost update on database when multiple accesses occur concurrently.
Thanks in advance for your patience,
TommasoHi all!
In a stateless session bean (EJB3) with container managed transactions I need to set the transaction isolation level to SERIALIZABLE.
The idea is to prevent lost update on database when multiple accesses occur concurrently.
Thanks in advance for your patience,
Tommaso
Maybe you are looking for
-
I keep getting error msg "Oops! Firefox could not find..." a lot!
On websites that I visit often, I have started to receive "Oops! Firefox could not find xlforum.net", etc. This is happening a lot. I've already done a virus/malware scan and the problem still exists. Any idea what's going on? == URL of affected site
-
i just bought first time i used it it works perfectly and the second time it doesn't work anymore it say's No supported creative camera detected. please plug in but it was plug in to continue, i open it again this time in my ym it say's webcam is not
-
Overiding Active X (pain in the A$$)
I have designed several pages for a website using multiple motion tweens of road signs and active x comes up when the page loads. This is really annoying and I just wondered if anybody knows some scripting I can easily use to overcome this. Much abl
-
Anyone had success installing on SuSe 6.2
I have the trial 8i 8.1.5 CD. After reading some of the posts here over the past few weeks. I'm torn between Red Hat and SuSe. So, I'm hoping to get some feedback before I procede. I'm leaning towards SuSe's 6.2 at the moment, but I could be swayed t
-
Update iPod on iTunes, went into recovery mode
I had an update on my iPod so when i was on iTunes it said to update so I did. It went into recovery mode, but i was luckily able to get it out (idk how lol). But i need to update it because my FaceTime isn't working and I am afraid it will do this a