Sunday, September 2, 2007

Transaction Isolation Levels

Isolation levels are defined by the concepts dirty read, non-repeatable-reads and phantom reads.
The levels are things like read commited, repeatable-read and serializable. The EJB spec doesn't define how these are set, so it's specific to the app server. Apparently you can set it if you get access to the JDBC connection, but then I assume you would have to make your whole bean BMP. There is pretty much no info on JBoss and isolation levels, except that it can be set in the datasource configuration. So perhaps you would have to create more than one datasource if you wanted more than one transaction isolation level available. Then I don't know how you would mix and match the use of these datasources with your session beans. Could you specify different entity managers and would these point to different persistence contexts and therefore not be in sync with eachother?

One article mentioned that with some appservers you can specify different isolations levels for different methods, which is ideal. Something like a transaction attribute I imagine.

No comments: