users@glassfish.java.net

EJBContainer dropping the tables after unit test

From: Gregory Gerard <ggerard_at_mac.com>
Date: Fri, 02 Apr 2010 17:18:13 -0700

I'm seeing a weird EclipseLink issue.

The code is an @Stateless with one method that creates a new entity and calls em.persist(obj) on it.

This works fine when loaded into the embedded glassfish and triggered through Jersey -- the tables are automatically created, I hit the EJBs by way of CURL and Jersey, I shutdown the server, the data is still there.

I run a JUnit test calling the same method that Jersey calls and things go odd from there. I don't see the tables I should in the DB much less the data.

Using MySQL proxy to inspect the whole conversation, I can actually see that the tables are being created and data is inserted. When I put in a Thread...sleep(20000) before closing the EJBContainer, I can see the data in mysql client.

However, when EJBContainer.close() gets called, I see drop table get sent!

This is unexpected.

Why the difference in behavior? How can I convince the EJBContainer to not drop my tables?

thanks!