persistence@glassfish.java.net

Re: Transaction isolation control

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Tue, 13 Nov 2007 12:45:19 -0500

But JDBC API supports setting transaction isolation on a JDBC Connection:

<http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html#setTransactionIsolation(int)>

Why is there something analogous for JPA?

James Sutherland wrote:
> The transaction isolation is normally set as a default in the database, or in
> the DataSource or connection pool, not at runtime. This is probably why the
> JPA did not cover it as of yet.
>
> In TopLink Essentials you can set the default transaction isolation level
> using a SessionCustomizer and calling the Session's DatabaseLogin's
> setTransactionIsolation(int) API.
>
>
> Farrukh Najmi-2 wrote:
>
>> Farrukh Najmi wrote:
>>
>>> I was wondering what is the rationale for JPA to provide no
>>> transaction isolation control in the API.
>>> Specifically, what were the issues that prevented
>>> EntityManager.getTransaction() to have a variant that
>>> took a isolation level looking something like this:
>>>
>>> EntityTransaction
>>> <http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityTransaction.html>
>>> *getTransaction*(int isolationLevel);
>>>
>> Oops. Above should read:
>>
>> EntityTransaction getTransaction(int isolationLevel);
>>
>>
>>

-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com