You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Tobias Trelle <to...@codecentric.de> on 2011/04/04 09:37:06 UTC
Re: NPE with Fetch Join Query
Rick Curtis wrote:
>
> It looks like you configured openjpa.RuntimeUnenhancedClasses=true and I'm
> certain is your problem. Please configure another method of
> enhancement[1]... Let me know if you have any issues getting your classes
> enhanced.
>
Thank you very much. It was indeed a matter of enhancement. Now my tests run
both with JDK1.6 (auto enhancement) and JDK1.5 using the -javaagent VM
parameter.
However, when using JDK 1.5 with javaagent, I am not able to use an own
classloader to redirect the resource persistence.xml to another file.
Typically, we are using a seperate persistence.xml per unit test, like
fetch-test-persistence.xml. That classloader ist attach to the current
thread ...
Thread.currentThread().setContextClassLoader(new
PersistenceXmlCustomClassLoader("fetch-test-persistence.xml"));
... and redirects to the given resource when it encounters a request for
persistence.xml. That happens _before_ the first access to
EntityManagerFactory and EntityManager.
I suppose the enhancer agent is triggered before that classloader is
registered with the thread and therefore the enhancer only sees the entities
in the standard persistence.xml.
Cheers,
Tobias
--
View this message in context: http://openjpa.208410.n2.nabble.com/NPE-with-Fetch-Join-Query-tp6222526p6237536.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.