> I'm having the following problem:
> It seems like sometimes that a data can be read
> before a transaction commit has occured. i.e a
> session bean can access a changed entity before it
> was commited.
What do you mean by changed entity before it was commited ?
> I have checked the following:
> (1) The mysql tables are configured as InooDB.
> (2) The mysql isolation mode is read-commited
> (3) The transaction level is required on all beans
> (4) The Commit-option of the jboss container is "B"
> though I have also tried "C"
> (5) The locking policy is "MethodOnlyEJBLock"
> It seems that the problem occurs when a local entity
> is being changed in a transaction and another session
> (in a different transaction) can find the changed
> When I look at the jboss debug messages I can rarely
> see the "FindByPrimaryKey" after the specific
> I need help on identifying the problem and solving
Once your Session Bean is accessing the Entity Bean in the Transaction,some other Concurrent Transaction can make changes in the Entity being used by the Session bean.You are getting the Phantoms ,for more details you can read the Mastering EJB(page 313-314).To solve the problem you should use the SERIALIZABLE mode of for Isolation Level.But this will drop the performance , so you should customize the logic which meets your requirement.For more info you can refer to the "Optimistic and Pessimesstic Locking" article from www.javaword.com.Plese let me know whether this works.
Hope this helps.
I don't think that I'm getting the phantom because I cannot see that the jboss is querying the database, I think that I get a local (in memory) version of the changed object. I think so because I'm using Value Object Design pattern and am reading the data after the finder, but I get different data then in the database.
Have you worked on this
For more info you can refer to the "Optimistic and Pessimesstic Locking" article from www.javaword.com.Plese let me know whether this works.
You design have the Value Object Design ,this implies that the Copy of data you have on the Client and by the time the Client make changes the actual copy on the Server may get changed due to some other Transaction,hence the local(in memory ) version is changed.
Well, I have worked on it and read all of the articles.
And the problem is different (aparently)
I use jdbc calls inside a managed session (because they are mixed with CMP entities)
the Jdbc calls are "AutoCommit=true" and the transaction is commited after their call.
I couldn't change the commit option , because it's a managed transaction.
nor could I use the "RequiresNew" and "Nested transactions" because they are not supported in Jboss.