problem about weblogic 8.1 with optimistic concurrency

Discussions

EJB programming & troubleshooting: problem about weblogic 8.1 with optimistic concurrency

  1. problem about weblogic 8.1 with optimistic concurrency (2 messages)

    I use the optimistic concurrency with
    <verify-columns>Modified</verify-columns> now I do the follow two steps:
    1.use the SBFacade to get the Customer EB reference(LocalObject) with primary key 'ID1'(in a transaction)
    2.use the LocalObject reference to update the EB.(another transaction)

    I get the following Exception:


    [EJB:010143]Optimistic concurrency violation. Instance of bean 'Customer' with primary key 'ID1' was changed by another transaction. - with nested exception:
    [weblogic.ejb.OptimisticConcurrencyException: [EJB:010143]Optimistic concurrency
     violation. Instance of bean 'Customer' with primary key 'ID1' was changed by an
    other transaction.]

    would give any suggestion about this problem?? thanks

    Threaded Messages (2)

  2. Response[ Go to top ]

    Zhen,

    And what did you expect??? Use optimistic locking only when you're sure or almost sure that you will not have two transactions which will modify the same data simulaneously...

    If they actually do, you'll get an error back and the transaction will be rolled back, what fully corresponds to the idea of optimistic locking paradigm,
    so the behaviour you actually see is usual.

    The possible workaround would be possibly to retry the transaction as many times as possible until it actually commits...

    Alex
  3. Hi Zhen

    I need an info from u.

    v would like to use Optimistic concurrency for our EJBs in BEA Weblogic 8.1.
    What are all the settings that i should make in the Weblogic DDs??

    Actually i am getting the following warning message...
    Can u throw light on it.

    <Warning> <EJB> <BEA-010197> <The entity bean XXX uses optimistic concurrency with read-verification enabled. The database indicates that exclusive row locks are not supported. Read-verification will not guarantee data integrity if the isolation level of the transaction is lower than repeatable read.>

    Thanx in advance
    Sathish