• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Isolation Level Session Beans

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
I have a problem with isolation level in weblogic.
Problem:
method defined in session Bean
public Collection (int count);

What this method does is as follows
There is a table which stores the last generated value of a sequence.
So when next time a request comes for two numbers the method reads the last generated value and gives back a two numbers next in sequence to the last generated value.But when two client requests comes concurrantly every ting goes wrong.Both gets the same numbers as the next sequence,since each reads the same value of last generated number. So i set the Isolation level of the method to TRRANSACTION_SERIALIZABLE_READ_COMMITED_FOR_UPDATE.The basic idea is i want a read lock on that particular row.I tried that and it doesnt work.Still i'm getting concurrency issues in that method.
How do i do that using Weblogic 8.1 and Oracle 9.2
Can any one help in this

Best Regards
Prem
 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMHO, Isolation levels are an aspect of the JDBC connection, not session bean methods. I am using JBoss, and when declaring the datasource; I can set its isolation level per connection. See jboss datasource dtd

I'm sure Weblogic will have something similar.

Regards,

Pho
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"So when next time a request comes for two numbers the method reads the last generated value and gives back a two numbers next in sequence to the last generated value..." - try this - Update the value of the last number in the table and select the new value within the same transaction.

conn.setAutoCommit(false);
BEGIN TRAN
update <tableName> set <field>=<field>+1
select <field> from <tableName>
END TRAN
conn.setAutoCommit(true);
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic