X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Feclipselink%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fpersistence%2Feclipselink%2FJndiSessionCustomizer.java;h=03beb9005f763d7850c0cb56656f2028508d7272;hb=685578ba5b0c34b26b127405cad1202623280e50;hp=ca74ec5cebc45c908098524540171e1e0eff44eb;hpb=5e33a52ba36ac928b9863ddd79d2d09f6a308af6;p=utils diff --git a/test/eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/JndiSessionCustomizer.java b/test/eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/JndiSessionCustomizer.java index ca74ec5c..03beb900 100644 --- a/test/eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/JndiSessionCustomizer.java +++ b/test/eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/JndiSessionCustomizer.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.support.persistence.eclipselink; import org.eclipse.persistence.config.SessionCustomizer; @@ -52,33 +52,29 @@ public class JndiSessionCustomizer implements SessionCustomizer { try { context = new InitialContext(); - if (null != context) { - connector = (JNDIConnector) aSession.getLogin().getConnector(); // possible - // CCE - // Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP - // Note: if both jta and non-jta elements exist this will only - // change the first one - and may still result in - // the COMPOSITE_NAME_LOOKUP being set - // Make sure only jta-data-source is in persistence.xml with no - // non-jta-data-source property set + connector = (JNDIConnector) aSession.getLogin().getConnector(); // possible + // CCE + // Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP + // Note: if both jta and non-jta elements exist this will only + // change the first one - and may still result in + // the COMPOSITE_NAME_LOOKUP being set + // Make sure only jta-data-source is in persistence.xml with no + // non-jta-data-source property set - connector.setLookupType(JNDIConnector.STRING_LOOKUP); + connector.setLookupType(JNDIConnector.STRING_LOOKUP); - // Or, if you are specifying both JTA and non-JTA in your - // persistence.xml then set both connectors to be safe - JNDIConnector writeConnector = (JNDIConnector) aSession - .getLogin().getConnector(); - writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP); + // Or, if you are specifying both JTA and non-JTA in your + // persistence.xml then set both connectors to be safe + JNDIConnector writeConnector = (JNDIConnector) aSession.getLogin() + .getConnector(); + writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP); - JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) aSession) - .getReadConnectionPool().getLogin()).getConnector(); - readConnector.setLookupType(JNDIConnector.STRING_LOOKUP); + JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) aSession) + .getReadConnectionPool().getLogin()).getConnector(); + readConnector.setLookupType(JNDIConnector.STRING_LOOKUP); - System.out.println("JndiSessionCustomizer: configured " + - connector.getName()); - } else { - throw new Exception("JndiSessionCustomizer: Context is null"); - } + System.out.println("JndiSessionCustomizer: configured " + + connector.getName()); } catch (Exception e) { e.printStackTrace(); }