[prev in list] [next in list] [prev in thread] [next in thread]
List: openejb-development
Subject: Re: Would using jndi more directly for cmp persistence-ref cause problems?
From: David Blevins <david.blevins () visi ! com>
Date: 2010-04-21 1:44:47
Message-ID: 25823F05-F6EA-4CD2-82AB-DB813187F069 () visi ! com
[Download RAW message or body]
On Apr 20, 2010, at 10:30 AM, David Jencks wrote:
> I have cmp 2 beans working in geronimo trunk with the following
> small change to how the cmp engine finds its EM:
>
> Index: container/openejb-core/src/main/java/org/apache/openejb/core/
> cmp/jpa/JpaCmpEngine.java
> ===================================================================
> --- container/openejb-core/src/main/java/org/apache/openejb/core/cmp/
> jpa/JpaCmpEngine.java (revision 935765)
> +++ container/openejb-core/src/main/java/org/apache/openejb/core/cmp/
> jpa/JpaCmpEngine.java (working copy)
> @@ -28,6 +28,7 @@
> import javax.ejb.EntityBean;
> import javax.ejb.FinderException;
> import javax.ejb.RemoveException;
> +import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceException;
> @@ -90,7 +91,8 @@
> private EntityManager getEntityManager(CoreDeploymentInfo
> deploymentInfo) {
> EntityManager entityManager = null;
> try {
> - entityManager = (EntityManager)
> deploymentInfo.getJndiEnc().lookup("java:comp/env/" +
> CMP_PERSISTENCE_CONTEXT_REF_NAME);
> + entityManager = (EntityManager) new
> InitialContext().lookup("java:comp/env/" +
> CMP_PERSISTENCE_CONTEXT_REF_NAME);
> } catch (NamingException ignroed) {
> }
>
>
> This might be marginally slower but since we're about to go talk to
> a database I don't think creating a couple extra jndi objects will
> be really noticeable.
>
> Anyone have a problem with me committing this change?
As discussed on IRC, it's fine as a temporary change to get more TCK
tests to run.
-David
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic