This content has been marked as final.
Show 1 reply
-
1. Re: Use of CMP EntityManager in POJO
voidhawc May 5, 2009 2:39 AM (in response to voidhawc)Found what could be the problem.
This is the code that causes the null pointer in 4.2.3.GApublic EntityManager getNonTxEntityManager() { Map map = nonTxStack.get(); EntityManager em = (EntityManager)map.get(this); // Null Pointer here if (em == null) { em = entityManagerFactory.createEntityManager(); map.put(this, em); } return em; }
Compared against the JPA code.public EntityManager getNonTxEntityManager() { Map<ManagedEntityManagerFactory, EntityManager> map = nonTxStack.get(); EntityManager em = null; if (map != null) em = map.get(this); else { map = new HashMap<ManagedEntityManagerFactory, EntityManager>(); nonTxStack.push(map); } if (em == null) { em = entityManagerFactory.createEntityManager(); map.put(this, em); } return em; }
As you can see there is a guard around the map reference code. However the code with a guard around it appears to from revision 75254 where as the code without a guard is from 75965 which is later.
However the 4.2 code appears to have been copied from 4.0 (rev 58000).
Does anyone happen to know which release this was fixed in?
Thanks