Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] How to archive Full EclipseLink Transaction Isolation (for RESOURCE_LOCAL transactions)

Hello everyone,

we need full transaction isolation using RESOURCE_LOCAL transactions in a non-JEE project. (this means no second level cache, isolated session caches for me as far as I understand the eclipselink cache architecture)

We are using an EclipseLink Session Customizer to bind our entity managers to a custom DataSource ( in fact a connection pool which returns distinct connection objects when calling acquireConnection() ).

Imagine the following situation, where em1 and em2 represents an EclipseLink EntityManager:


    User newObj = new User();
    newObj.setAuthMode('A');

    em1.persist(newObj);
    id = newObj.getId();
    LOGGER.debug("persisted object, new id is " + id);

    assertNull(em2.find(User.class, id));

The assertion fails, em2 returns the new object although the underlying transaction of em1 has not been commited yet.
How can I archive full transaction isolation within EclipseLink?

Excerpt from my persistence.xml:

   <property name="eclipselink.jdbc.read-connections.shared"
    value="false"/>

   <property name="eclipselink.cache.shared.default" value="false"/>

   <property name="eclipselink.jdbc.exclusive-connection.mode"
    value="Always"/>


Best regards,
Patric









Back to the top