CMP Isolation Level
With CMP it is possible to implement a pessimistic locking strategy by selecting 'lock-when-loaded'. Optimistic concurrency control can be accomplished by selecting <check-modified-at-commit>.
But what about setting the isolation level for the connection pool the Persistence Manager uses?
Is it possible and does it make sense to combine optimistic concurrency control with the different isolation levels?
Thanks for helping
Assuming you are using the bc4j cmp implementation, the default for isolation level is TX_READ_COMMITTED so I don't think you run the risk of phantom or dirty read.
Unfortnately as of now this property cannot be specified declaratively.
It looks like you want to run the getNEXTID() with the RequiredNew transaction attribute.
null
Similar Messages
-
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. -
How to define TX_SERIALIZABLE isolation level for a CMP EJB
Hi JDev Team,
I have created a portable Primary Key Generator realized as a CMP Entity Bean which
has a method getNEXTID().
This method returns a PK from a table
and increments it by one.
My question is:
How can I set the transaction isolation level of getNEXTID() to TX_SERIALIZABLE in order to avoid phantom and dirty read problems?
Best Regards,
Stoyan K.Assuming you are using the bc4j cmp implementation, the default for isolation level is TX_READ_COMMITTED so I don't think you run the risk of phantom or dirty read.
Unfortnately as of now this property cannot be specified declaratively.
It looks like you want to run the getNEXTID() with the RequiredNew transaction attribute.
null -
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 -
Setting transaction isolation level in Weblogic 5.1
Hi,
I'm using Weblogic server5.1 and i'm trying to set the isolation level on one
of my session bean. Below is the code :
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>chargeMgr</ejb-name>
<jndi-name>chargeMgr</jndi-name>
<transaction-isolation>
<isolation-level>Serializable</isolation-level>
<method>
<ejb-name>chargeMgr</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
</transaction-isolation>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
I have checked the syntax against the weblogic documentation.
However, when i try to jar the beans up into the jar file (weblogic.ejbc), it
give me the following error :
org.xml.sax.SAXParseException: Element "weblogic-enterprise-bean" allows no further
input; "transaction-isolation" is not allowed.
Can anyone help?
Regards.
yes, only in weblogic-ejb-jar.xml , and you can see that from the DTD
source.
thanks
Yu
"cw lee" <[email protected]> wrote in message
news:[email protected]...
>
> thanks for ur advice.
>
> one thing i forgot to mention is that the isolation-level was specified in
weblogic-ejb-jar.xml.
> Do u mean that it must be placed in weblogic-cmp-rdbms-jar.xml and not
weblogic-ejb-jar.xml
> ?
>
> Are the codes u suggested to be in weblogic-ejb-jar.xml or
weblogic-cmp-rdbms-jar.xml
> ?
>
> Regards.
>
>
>
> "Yu Tian" <[email protected]> wrote:
> >the right name for Seriealizable should be: TRANSACTION_SERIALIZABLE.
> >so the
> >DD looks like:
> >
> ><?xml version="1.0"?>
> >
> ><!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
> >5.1.0
> >EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
> >
> ><weblogic-ejb-jar>
> > <weblogic-enterprise-bean>
> > <ejb-name>containerManaged</ejb-name>
> > <caching-descriptor>
> > <max-beans-in-cache>1000</max-beans-in-cache>
> > </caching-descriptor>
> > <persistence-descriptor>
> > <persistence-type>
> > <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
> > <type-version>5.1.0</type-version>
> > <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
> > </persistence-type>
> > <persistence-use>
> > <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
> > <type-version>5.1.0</type-version>
> > </persistence-use>
> > </persistence-descriptor>
> > <jndi-name>containerManaged.AccountHome</jndi-name>
> > <transaction-isolation>
> > <isolation-level>TRANSACTION_SERIALIZABLE</isolation-level>
> > <method>
> > <ejb-name>containerManaged</ejb-name>
> > <method-name>*</method-name>
> > </method>
> > </transaction-isolation>
> > </weblogic-enterprise-bean>
> > </weblogic-ejb-jar>
> >
> >Thanks
> >
> >Yu
> >
> >
> >"cw lee" <[email protected]> wrote in message
> >news:[email protected]...
> >>
> >> Hi,
> >>
> >> I'm using Weblogic server5.1 and i'm trying to set the isolation level
> >on
> >one
> >> of my session bean. Below is the code :
> >>
> >> <weblogic-ejb-jar>
> >> <weblogic-enterprise-bean>
> >> <ejb-name>chargeMgr</ejb-name>
> >> <jndi-name>chargeMgr</jndi-name>
> >> <transaction-isolation>
> >> <isolation-level>Serializable</isolation-level>
> >> <method>
> >> <ejb-name>chargeMgr</ejb-name>
> >> <method-intf>Remote</method-intf>
> >> <method-name>*</method-name>
> >> </method>
> >> </transaction-isolation>
> >> </weblogic-enterprise-bean>
> >> </weblogic-ejb-jar>
> >>
> >> I have checked the syntax against the weblogic documentation.
> >> However, when i try to jar the beans up into the jar file
(weblogic.ejbc),
> >it
> >> give me the following error :
> >>
> >> org.xml.sax.SAXParseException: Element "weblogic-enterprise-bean"
allows
> >no further
> >> input; "transaction-isolation" is not allowed.
> >>
> >> Can anyone help?
> >>
> >> Regards.
> >>
> >
> >
>
-
Transaction Isolation Level in Oracle 10g XE
Hi All
I have two CMP entities (EJB3) defined over two tables in Oracle 10g XE DB, namely User & UserDetails. UserDetails references User entity in One-to-one unidirection fashion.
When I create a new User I have to insert a record using User entity & a corresponding record using the UserDetail.
Since the first insert is not committed when the UserDetails entity tries to insert the record in the UserDetails table. The parent child relationship fails.
Where should I define the DB isolation level?
Thanks in advance.
Regards
AbhinavHi All
I have two CMP entities (EJB3) defined over two tables in Oracle 10g XE DB, namely User & UserDetails. UserDetails references User entity in One-to-one unidirection fashion.
When I create a new User I have to insert a record using User entity & a corresponding record using the UserDetail.
Since the first insert is not committed when the UserDetails entity tries to insert the record in the UserDetails table. The parent child relationship fails.
Where should I define the DB isolation level?
Thanks in advance.
Regards
Abhinav -
A string of question about Locking & Isolation Level
Hi All
It is highly appreciated if someone give offer answers to my below questions
1) There are two ways of locking mechanism: Pessimistic & Optimistic. In general, do all J2EE app server support all these two ways of locking ?
2) It seems to me that setting the isolation level to "serialization" should result in using pessmistic locking. If no so, please point out my misconcept and explain to me.
3) Are there any differences in the way of entity bean programming as different locking mechansim is adopted ?
4) With regard to optimistic locking, will the app server throw out exception as data contention is detected ? Is the way of handling dependent on app server? Or It is transparent to the developer of entity bean. Please give me an e.g of j2ee app server product how to handle this scenario.
5) To adopt the approach of "optimistic" locking, do l have to implement it on my own using bean managed entity bean.
6) It seems to me that optimistic locking can achieve better concurrency. If it is inherently supported by app server for its container managed entity bean (=> totally transparent to the developer of entity bean). Is it always the rule of thumb to config the server to use "optimistic" locking instead of "pessimistic" ?
Sorry for bombarding you guys with such long list of questions. l would be very thankful if someone can help me consolidate my concept on these topics.
Also, please send your reply to [email protected] as well
thanks & regards
DannyHi Danny,
I became interested about the optimistic locking recently. If the topic is not long forgotten then this may make some difference!
We have attacked the optimistic locking issue by introducing audit fields (MODIFY_BY_USER, MODIFY_DATE) in tables where concurrency needs to be implemented.
We are retrieving rows from the table (for display or update) through Stateless Session Bean using simple SQL SELECT. The audit fields are fetched along with the business data and are kept at the client. While any of the concurrent users tries to update the row the audit fields are sent to the application server along with the modified business data. The relevant Entity Bean checks for any difference in the timestamp of the audit field (MODIFY_DATE) value with the value in the database. If a mismatch is found it reports a business exception to the user. Otherwise, the row is updated with the lastest timestamp value in the audit field MODIFY_DATE.
This works fine when two update operations are not concurrent, i.e., two users submit their update requests in a time lag greater than the time taken by the transaction to complete. This alone could not prevent the dirty update on the database.
Hence, to prevent any concurrent update contending for the same row you need to set the following ejbgen tag in the Entity Bean:
concurrency-strategy = Exclusive<<<<<Note: We are using Weblogic 6.1 with SP4 and CMP (no BMP).
Please let me know if you have got a better solution to tackle this issue.
Chandra. -
Does anyone know of a way to capture the current isolation level for a given transaction,
in particular w/ a CMP entity bean?
I'm using the P6SPY driver to capture debug information, but I never see a call
to Connection.setTransactionIsolation(). Therefore, I have no way to know if
my transaction is running with Serializable level, the level I've set in my weblogic-ejb-jar.xml
file.
Running WLS 6.1 and JConnect 5.5.
Thanks,
Jim
Just tried the code below. Compiles -- that id good ;)
When I'm outside transaction I get weblogic.transaction.TxHelper.getTransaction()
== null.
That is to be expected.
When I'm inside transaction the property value is null. Properties that I can
get:
[0] key
weblogic.transaction.name val [EJB om.moveitonline.framewo
[1] key weblogic.jdbc val t3://10.1.26.51:7001.
Questions:
a) How to get the isolation level anyway?
b) What are the integer values for isolation levels (i.e. constants)?
Rob Woollen <[email protected]> wrote:
>Try this:
>
>Integer iso =
>weblogic.transaction.TxHelper.getTransaction().getProperty(weblogic.transaction.TxConstants.ISOLATION_LEVEL);
>
>-- Rob
>
>
>Jim clark wrote:
>> Does anyone know of a way to capture the current isolation level for
>a given transaction,
>> in particular w/ a CMP entity bean?
>>
>> I'm using the P6SPY driver to capture debug information, but I never
>see a call
>> to Connection.setTransactionIsolation(). Therefore, I have no way
>to know if
>> my transaction is running with Serializable level, the level I've set
>in my weblogic-ejb-jar.xml
>> file.
>>
>> Running WLS 6.1 and JConnect 5.5.
>>
>> Thanks,
>> Jim
>
-
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- -
Isolation Level vs. Locking
Hello,
I am still wrestlling a bit with the issues involved in setting an isolation
level. I am using WL 5.1, Oracle, and CMP.
I do now understand the issues involved between Oracle's
SERIALIZABLE and READ-COMMITTED isolation levels, etc.
But I also note that weblogic uses a pessimistic locking
approach for serializing access to entity ejb's. Doesn't this
locking supercede anything but an isolation level of
SERIALIZABLE? What happens with an isolation level
of READ-COMMITTED, even though the access to an
entity within any transaction will be serialized anyway?
Are there issues related to persistence issues outside of
ejb's, such as using JMS persistent messages within the
same system (same connection pool, etc.).
Also, I note that the ejb 2.0 spec in weblogic will allow
a more optimistic locking model. In this case, how will
multiple commits behave, will they behave according
to the isolation level chosen (READ-COMMITTED
or SERIALIZABLE?).
It's all confusing. What is the point, in ejb 1.1, for allowing
the bean developer to specify an isolation level, if all
access to entities will be done with exclusive locks?
What happens with multiple result finder methods? Does
this place exclusive locks on each entity found, within
a transaction?
Should I spend more time worrying about locking
models or isolation levels.
Am I just going around in circles?
Jason
Jason Rosenberg
SquareTrade
(remove 'nospam' from my return address)Well, for now, I am designing for Oracle. What do you mean
by hazy?
Kirk Wylie <[email protected]> wrote in message news:[email protected]...
Probably not something you can count on guaranteeing no blocking. The
database could very well block here, particularly if your'e using
anything other than Oracle on the back-end, and Oracle can be a bit,
ahem, hazy in its acceptance of its own semantics here.
Kirk Wylie
Jason Rosenberg wrote:
Well, if the database table is set up to use READ-COMMITTED,
then it shouldn't block on the database, correct?
Jason
Cameron Purdy <[email protected]> wrote in message news:[email protected]...
... which means it could block on the database, correct?
Cameron Purdy
"Rob Woollen" <[email protected]> wrote in message
news:[email protected]...
A finder will never block on a container lock. For instance, imagine
that primary keys 3 and 4 are currently participating in a transaction
and are locked in server A. If a finder is called in server A which
returns these keys, the finder will run independently of the EJB server
locks. (Of course the database isolation will still apply.)
-- Rob
Jason Rosenberg wrote:
Ah, clustering saves the day!
I'm wondering though, since we don't have control over which
server in a cluster a given ejb may run on at any given time,
the concurrent behavior may be different to control. Some
times you can have concurrent access based on
READ-COMMITTED on the db level, and some times weblogic
will force a SERIALIZABLE behavior if 2 conflicting
ejb's get instantiated in the same container.
This is what I want. I would like complex finder methods
to be able to return a collection of primary keys over a
table, based on a READ-COMMITTED basis. This
needs to happen often, and shouldn't block (it's ok
if it misses out on uncommitted data in process, or
if it returns keys that may be in the process of being
deleted). But I don't ever want it to block because
another component has uncomitted changes in process.
Ideas? Wait for ejb2.0?
Jason
Rob Woollen <[email protected]> wrote in message
news:[email protected]...
It matters if you are in a cluster, or if othercomponents/applications
are accessing the same data.
It will also matter if your db does not have row-level locking.
-- Rob
Jason Rosenberg wrote:
I've excerpted below some of the text from the weblogic
documentation.
What this says to me is that, indeed, if an ejb entity is in anywayinvolved
in a transaction, all other transactions will be blocked frominstantiating
and using the bean instance until the transaction is over.
This is a de-facto SERIALIZABLE isolation level, is it not, with allthe
plusses and minuses. The plus is that data integrity is maintained,the
minus is that concurrent access is negatively effected.
What am I missing. Given this mechanism, what difference does it
make whether I use of a transaction isolation level ofREAD-COMMITTED
or SERIALIZABLE?
It looks like the story does change for ejb2.0.....
From the weblogic online documentation at:
http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_environment.html#108796
7
Locking Model for Entity EJBs
The EJB 1.1 container in WebLogic Server Version 5.1 uses apessimistic locking mechanism for entity EJB instances. As clients
enlist an EJB or EJB method in a transaction, WebLogic Server placesan exclusive lock on the EJB instance or method for the
duration of the transaction. Other clients requesting the same EJBor method block until the current transaction completes.
This method of locking provides reliable access to EJB data, andavoids unnecessary calls to ejbLoad() to refresh the EJB
instance's
persistent fields. However, in certain circumstances pessimistic
locking may not provide the best model for concurrent access to
the
EJB's data. Once a client has locked an EJB instance, other clients
are blocked from the EJB's data even if they intend only to
read
the persistent fields.
To improve concurrent access for entity EJB's, the WebLogic Server
EJB 2.0 container enables you to defer locking services to
the
underlying database. In most cases, the underlying data store can
provide finer granularity for locking EJB data, and improve
throughput for concurrent access to the bean's data. See EJB 2.0 forBEA WebLogic Server Overview for more information.
Cameron Purdy <[email protected]> wrote in message
news:[email protected]...
I believe the "locking" refers to an internal WL implementationthat
prevents multiple threads from accessing an EJB instance.
Cameron Purdy, LiveWater
"Jason Rosenberg" <[email protected]> wrote in message
news:[email protected]...
Hello,
I am still wrestlling a bit with the issues involved in setting
an
isolation
level. I am using WL 5.1, Oracle, and CMP.
I do now understand the issues involved between Oracle's
SERIALIZABLE and READ-COMMITTED isolation levels, etc.
But I also note that weblogic uses a pessimistic locking
approach for serializing access to entity ejb's. Doesn't this
locking supercede anything but an isolation level of
SERIALIZABLE? What happens with an isolation level
of READ-COMMITTED, even though the access to an
entity within any transaction will be serialized anyway?
Are there issues related to persistence issues outside of
ejb's, such as using JMS persistent messages within the
same system (same connection pool, etc.).
Also, I note that the ejb 2.0 spec in weblogic will allow
a more optimistic locking model. In this case, how will
multiple commits behave, will they behave according
to the isolation level chosen (READ-COMMITTED
or SERIALIZABLE?).
It's all confusing. What is the point, in ejb 1.1, for allowing
the bean developer to specify an isolation level, if all
access to entities will be done with exclusive locks?
What happens with multiple result finder methods? Does
this place exclusive locks on each entity found, within
a transaction?
Should I spend more time worrying about locking
models or isolation levels.
Am I just going around in circles?
Jason
Jason Rosenberg
SquareTrade
(remove 'nospam' from my return address)
Kirk Wylie | mailto:[email protected] | http://www.radik.com -
Hi ,
I was using the DDConvertor supplied with WL51 to convert my old
DeploymentDescriptor.txt to the new XML format.
I have noticed that the Isolation Level did not pass to the new format.
My entity bean is not container managed and the Isolation level is
READ_COMMITED .
No weblogic-cmp-rdbms-jar.xml File was generated.
Attached are the files.
Could you please tell me where can I specify the Isolation Level if I have
no rdbms file ?
thanks
Amit Sivan
[DeploymentDescriptor.txt]
[weblogic-ejb-jar.xml]weblogic-ejb-jar.xml
amit sivan wrote:
Hi ,
I was using the DDConvertor supplied with WL51 to convert my old
DeploymentDescriptor.txt to the new XML format.
I have noticed that the Isolation Level did not pass to the new format.
My entity bean is not container managed and the Isolation level is
READ_COMMITED .
No weblogic-cmp-rdbms-jar.xml File was generated.
Attached are the files.
Could you please tell me where can I specify the Isolation Level if I have
no rdbms file ?
thanks
Amit Sivan
; Copyright (c) 1998-1999 by BEA WebXpress. All Rights Reserved.
(EntityDescriptor
beanHomeName pay2card.OnlineHomeEntity
enterpriseBeanClassName pay2card.beans.online.entity.OnlineEntityBean
homeInterfaceClassName pay2card.beans.online.entity.OnlineEntityHome
remoteInterfaceClassName pay2card.beans.online.entity.OnlineEntity
isReentrant false
(accessControlEntries
; DEFAULT [admin manager]
); end accessControlEntries
(controlDescriptors
(DEFAULT
isolationLevel TRANSACTION_READ_COMMITTED
transactionAttribute TX_REQUIRED
runAsMode CLIENT_IDENTITY
; runAsIdentity admin
); end DEFAULT
); end controlDescriptors
(environmentProperties
; homeClassName
; ejbObjectClassName
maxBeansInFreePool 20
maxBeansInCache 1000
idleTimeoutSeconds 60
; isModifiedMethodName isModified
); end environmentProperties
; Entity EJBean-specific properties:
primaryKeyClassName pay2card.beans.online.entity.OnlinePK
; end entity EJBean-specific properties.
); end EntityDescriptor
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>pay2card.OnlineHomeEntity</ejb-name>
<caching-descriptor>
<max-beans-in-free-pool>20</max-beans-in-free-pool>
<max-beans-in-cache>1000</max-beans-in-cache>
<idle-timeout-seconds>60</idle-timeout-seconds>
</caching-descriptor>
<persistence-descriptor>
<delay-updates-until-end-of-tx>false</delay-updates-until-end-of-tx>
</persistence-descriptor>
<jndi-name>pay2card.OnlineHomeEntity</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar> -
I know there are four isolation levels :-
TRANSACTION_READ_UNCOMMITTED
TRANSACTION_READ_COMMITTED
TRANSACTION_REPEATABLE_READ
TRANSACTION_SERIALIZABLE
but in EJB where we declare these isolation levels. Are they declared in any xml file or define somewhere in bean class. what about CMP and BMP implements regarding isolation levels.??
Anybody tell me please . Thanks in advanceI also wanted to know where to set these Isolation levels in JDBC .http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#setTransactionIsolation(int)
-
Default transaction isolation level
Hi,
What is the default transaction isolation level in weblogic?
Is it dependent on the database isolation level?
Pradeep bhatIn 6.1, the default transaction isolation level for CMP beans is the level specified
in the database.
In 5.1, the default is supposed to be serializable, though there is a bug in 5.1
that does not set the level at all. I have received a confirmation from Weblogic
that this is a bug.
Dan
"pradeep bhat" <[email protected]> wrote:
>
Hi,
What is the default transaction isolation level in weblogic?
Is it dependent on the database isolation level?
Pradeep bhat -
Hello,
I'm new to the Oracle environment and have just started using PL/SQL on Oracle 8i. Where can I find info on how Oracle locks data and how transaction isolation levels are used? We've still not recvd our manuals so please any replies referring to manuals are not welcome!You could move forward balance into its own table. That was, the SELECT will not lock on the original table. Most of the running balance schemes that I have seen take a snapshot as of a given date (say, statement printing date) and record both the timestamp and the amount. Next month, you simply get last month's vaule and timestamp and query on transactions after that timestamp.
- Saish -
Can you set isolation levels of message-driven bean transactions?
The problem: I have 3 different message-driven beans which each get a different type of message, except for a field that is common to all. That field is used as the primary key of an entity object. The message-driven beans configured to use a container managed transaction. Each message-driven bean, in processing the message, first does a lookup by primary key to see if the object associated with the key exists, and if it does not, it requests the entity's home object to create it. After that, they do further processing. The problem is that sometimes all the beans simultaneously get a message, resulting in each bean checking for the entity object at about the same time, and if they fail to find it (because none of them has created it yet), each creates an object, all with the same primary key. This is not caught until the beans start to complete their onMessage method, which I believe results in the container committing the transaction. One of the transactions will be committed successfully, while the other two will fail, get rolled back, and then be retried with the same message. The second time through, the other beans will find the entity object (since it has been created and committed) and they will complete correctly. In the end, they right thing occurs, except that there is a troubling exception or 2 in the log telling about the constraint violation (with the primary key) and the rollback. If it was just me, that would be fine, but our customer does not like to see exceptions in the log; that indicates to him that something is wrong.
So, I am looking for someway to make sure that the actions of the message-driven beans are serialized. One suggestion from a colleague was to set the isolation level of the transactions being used by the container in processing the message-driven beans' onMessage method. However, the documentation does not mention any way to do this for a message-driven bean. Suggestions?
Is the use of a UserTransaction a better way to do this? If I acquire a UserTransaction within the onMessage method of a message-driven bean, can I set its isolation level? How would this work? When I get a UserTransaction, does each client get a different transaction, or do they all get the same one?(1) The WebLogic JMS "unit-of-order" feature is a heavily adopted feature that was specifically designed to handle similar use cases - see the JMS developer guide for extensive documentation. In your use case, if "key" is used to define UOO, then there's no limit on the number of keys that can be processed concurrently, but messages for any particular key will be processed single-threaded in the order in which they were first submitted.
Note that if you're using distributed destinations, the UOO feature is still fully supported - but the developer and/or administrator needs to decide whether to configure the destination to use "hash" or "path service" based routing (the JMS UOO edoc outlines the trade-offs).
(2) Another alternative is to use a single MDB with max-beans-free-pool that processes all three types (as the other poster suggested). I think this assumes all MDBs run on the same JVM.
(3) Another alternative is to use multiple queues, with a single MDB on each Q. Where some sort of hash algorithm is used to determine which Q is for the key. This approach is a "hand-coded" variant of the approach in (1) with "hash" based routing enabled...
(4) If all MDBs actually do run in the same JVM, a third alternative is to use code the application to use a common lock to protect each key, eg, something like:
// assume MyLock is simply a class with a "reference counter"
// assume some global "staticHM" hash map that is all MDBs can access
onMessage() {
MyLock lock = null;
key= msg.getKey();
synchronized(staticHM) {
lock = staticHM.get();
if (lock = null) {
lock = new lock();
staticHM.put(key, new lock());
lock.incRefCount();
try {
synchronized(lock) {
// only one onMessage will be able to lock a particular key at a time
do your work;
} finally {
synchronized(staticHT) {
if (lock.defRefCount() == 0) staticHM.remove(lock);
if (lock = null) staticHM.put(key);
If multiple threads get a message with the same key, then only one thread at a time will work on the key.
Hope this helps,
Tom
Maybe you are looking for
-
How do *you* handle Old Time Radio (OTR) shows in iTunes?
I collect OTR shows, free from Internet Archive. 1. If you do as well 2. How do you put them into iTunes? As music or possibly audiobooks? 3. How do you signify it is OTR. Currently I have them as Music, with "OTR" in the Genre list. But that really
-
No Configuration In Install base for procured Items
No configuration is build in Install base for Configured Items procured thru PO. Problem Description: We created a PO for a Configured Item and received into an Org ( setup as serialized at receipt) for stocking purpose. The Entire Configuration is n
-
Flash fails to play videos with hangul (korean) strings.
GOMTV just started the first StarCraft 2 GSL, and I've been watching VODs as I'm in North America and don't want to stay up until 7am every night. Thankfully GOM is giving away VODs, all you have to do is register at gomtv.net. The issue is that some
-
Aperture .plist File Is Lost
I need to reach to my Aperture's .plit file that must be in username/Library/Preferences . But in that folder there is no com.apple.aperture.plist file. I made search by Sotlight but no such file is found. What may be the problem? I have a viewer scr
-
T.code : IH01. the equipement can not be displayed
Hi SAP PMasters, I've an issue with my IH01 i've created functional locations and equipements i've linked them in the structure so, i see the created funcional locations but not the linked equipment i mean that in the functional location specific dis