users@glassfish.java.net

Execute sql script in in-memory derby database with embedded glassfish

From: <glassfish_at_javadesktop.org>
Date: Wed, 06 Oct 2010 17:40:08 PDT

Hi!

I've been dealing with this de whole day. And could not find a solution.

I'trying to do this:

Load data to be used for testing Session Bean from a sql script. The tests are running in an Embedded Glassfish.

I had 2 ideas but I could not implement any of these.

1) Obtain the EntityManager and run the script using executeUpdate(). The problem: in the test class, I cannot begin a transaction

2) In the test package, create a session bean and do the executeUpdate() inside the EntityBean. The problem: I don't know how to use a Session Bean that is included in the test package.

I'm using these properties to start glassfish:

                Map properties = new HashMap();
                        properties.put(EJBContainer.MODULES, new File("target/classes"));

                        properties.put("org.glassfish.ejb.embedded.glassfish.installation.root", "/Applications/NetBeans/sges-v3/glassfish");
                        createEJBContainer = EJBContainer.createEJBContainer(properties);
                        context = createEJBContainer.getContext();
[Message sent by forum member 'driv']

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