Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ? the same db connection throughout many queries with one entitymanager instance in one method ?

Use property "eclipselink.jdbc.exclusive-connection.mode" with value "Always"

If the property is specified in persistence.xml or passed to createEntityManagerFactory method then all EntityManagers created by the factory will keep the same connection.

Alternatively - to create a single EntityManager with this option - pass the property to createEntityManager method.

Note that such EntityManager holds the same connection until closed, so to avoid connection leak it should be closed when no longer needed.

On 7/3/2012 11:34 AM, Varga Daniel (KIRF 681) wrote:
Hello

We need to find a means to guarantee that the same connection is being
used behind the scenes when executing a number of queries with the same
entitymanager instance within one method.

So far we did it with pinning the connections to the thread, which is a
weblogic specific feature that cannot be used in production.

If anyone know the best way to do it with eclipselink I’d be glad to let
known.

Thanks a lot,

Daniel



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top