This helps in unit testing.
Asked
Active
Viewed 1,348 times
2 Answers
7
The following should work for you:
ServerSession session = entityManager.unwrap(ServerSession.class);
SchemaManager schemaManager = new SchemaManager(session);
schemaManager.replaceDefaultTables(true, true);

Gordon Yorke
- 1,996
- 11
- 7
-
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 Oct 23 '10 at 17:25
1
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
- 10,709
- 20
- 81
- 126