on 07-14-2016 4:30 PM
Hi,
I want to use optimistic locking on selected EJB entities. I annotated an entity-Attribute as @Version (type long) and changed isolation level on the data source alias to 'transaction read committed'. But the entities version-attribute is not incremented and no exception is thrown. What do I need to do in order to make optimistic locking work in NetWeaver 7.31 / JPA 1.0 and MaxDB?
Thanks.
Regards
Anja
Hello Anja,
Are you talking about enqueue locks (transaction SM12)?
Regards,
Isaías
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Isaias,
I'm developing a JEE application with EJB, running on NW 7.31 with two nodes, no cluster. I face a concurrency problem: two threads access concurrently the same entity to modify it and the thread writing last overwrites the changes of the earlier thread. I don't see a way to avoid programmatically for sure that two threads operate concurrently. JEE offers entity annotation @versionId (the field is handled by the persistence provider) which combinded with DB-isolation level READ_COMMITTED guaranties that such inconsistencies are avoided. Although changing isolation level on the DB connection in NWA and restarting the server, a redeployment seems to reset the change. At least the isolation level change is not for long. I figured out to make optimistic locking work with READ_UNCOMMITTED and a version generation table (configured in persistence.xml), although it should be possible to set reliable the DB isolation level. Using the @versionId should be simple as this whereas the enqueue server seems to be complicated.
But finally I have to solve this concurrency problem, no matter what the best solution might be.
Regards
Anja
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.