JPA and MySQL transaction isolation level?

You need to set it at the connection level, get the session from the entitymanager and do this.

You need to set it at the connection level, get the session from the entitymanager and do this: org.hibernate. Session session = (Session)entityManager.getDelegate(); Connection connection = session.connection(); connection. SetTransactionIsolation(Connection.

READ_UNCOMMITTED).

I'm using an entity manager, not a session. – armandino May 27 '10 at 19:24 that's why I said "get the session from the em" ;) I edited the code – Guillaume May 27 '10 at 19:30 and what if it is not hibernate? – Bozho May 28 '10 at 5:00 Well, he said he's using I guess there are similar ways to do this for other for other JPA implementations.

– Guillaume May 28 '10 at 5:29 I did try your approach in the end but it didn't work unfortunately; seeing that session.connection() method was deprecated, I decided not to spend time investigating. – armandino Jun 3 '10 at 17:44.

In JPA you don't. JDO is the only standard that supports setting txn isolation. Obviously going for particular implementations methods can allow it, but then you become non-portable.

Since you are using BMT, you can do the following using a datasource to get the connection. And set the iso. Level.

DataSource source = (javax.sql. DataSource) jndiCntxt. Lookup("java:comp/env/jdbc/myds"); Connection con = source.

GetConnection( ); con. SetTransactionIsolation(Connection. TRANSACTION_READ_UNCOMMITTED).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions