A: 

One way to do that is to execute the sql scripts eclipselink generates specifying:

      <property name="eclipselink.ddl-generation.output-mode" value="both"/>

in persistence.xml

simpatico
+3  A: 

The following should work for you:

ServerSession session = entityManager.unwrap(ServerSession.class);  
SchemaManager schemaManager = new SchemaManager(session);  
schemaManager.replaceDefaultTables(true, true);
Gordon Yorke
I've replaced your code with my database destroying code, but then tests fail. Why could that be? Do I have to run this code inside a transaction?
simpatico
No this code should be run outside of a transaction.
Gordon Yorke