users@glassfish.java.net

Re: [Glassfish embedded] Problem with JPA2 entities in jar in a war

From: <glassfish_at_javadesktop.org>
Date: Mon, 06 Sep 2010 06:19:48 PDT

Ok I just had a minor breakthrough....

This works:

                File[] ejbModules = new File[2];
                ejbModules[0] = new File("target/simple-0.1-SNAPSHOT-LOCAL.war");
                properties.put(EJBContainer.MODULES, ejbModules);

So if feed the webapp compiled by Maven to Glassfish, everything is fine and the jpa2 entities are loaded from a jar inside simple-0.1-SNAPSHOT-LOCAL.war. So unit tests executed with maven works. But the downside is that we now can't execute tests in Eclipse using the Eclipse compiled code (edit, compile, run) but need to do a maven build each time we change code.

But, shouldn't this work in Embedded Glassfish?

                File[] ejbModules = new File[2];
                ejbModules[0] = new File("../simple-jpa/target/classes");
                ejbModules[1] = new File("target/classes");
                properties.put(EJBContainer.MODULES, ejbModules);

Meaning, use target/classes for both this project and the jpa project? Would be very nice to get this working.

-Anders
[Message sent by forum member 'andersaab']

http://forums.java.net/jive/thread.jspa?messageID=481970