Community
Participate
Working Groups
Build Identifier: 2.2.0 In EL 2.2 I am unable to configure EL to use external connection pooling with exclusive isolated client sessions. Within Eclipselink 2.1 I do the following to archieve this: connectionPolicy.setPoolName(null); connectionPolicy.setExclusiveMode(ExclusiveMode.Always); emProperties.put(EntityManagerProperties.CONNECTION_POLICY, connectionPolicy); (emProperties are passed to the EntityManagerFactory, persistence.xml contains <property name="eclipselink.jdbc.exclusive-connection.mode" value="Always"/> of course) However, in EL 2.2 this seems to be not sufficient anymore because setPoolName() will now be overriden by the default connection policy at some time after entity manager creation. (why?) I tried to use a SessionCustomizer which will change the default connection policy to set the pool name to null - however, this resulted in an NPE: java.lang.NullPointerException at org.eclipse.persistence.internal.sessions.IsolatedClientSession.<init>(IsolatedClientSession.java:40) at org.eclipse.persistence.sessions.server.ServerSession.acquireClientSession(ServerSession.java:382) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.getActivePersistenceContext(EntityManagerImpl.java:1576) at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.begin(EntityTransactionImpl.java:49) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.beginTransaction(JUnitTestCase.java:299) at org.eclipse.persistence.testing.tests.jpa.advanced.ExclusiveIsolatedSessionAndBatchWriteTest.testNoOp(ExclusiveIsolatedSessionAndBatchWriteTest.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:503) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) What is the correct way to configure EL 2.2 to use external connection pooling with exclusive isolated client sessions? Without this, I cannot use EL 2.2 so this is in fact a blocker to me. BTW: why is the setPoolName(null) a magically switch? Shouldn't it named like setExternalConnectionPooling(true) instead? Reproducible: Always
Targetting for next 2.2 patch.
You need to add connectionPolicy.setLogin(session.getLogin()); Without that connectionPolicy with neither connectionPool nor login is populated with defaults.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink