How to manually invoke create-drop from JPA on Hibernate?

Viewed 4826

I need this for an integration test. My environment is JBoss 7, EJB3 with JPA on Hibernate 4, H2 in-memory database and tests are run by Arquillian. I want to be able to drop the database and create it again will all tables based on persistence.xml and the entities. I know I can do it at the start of the application by specifying:

<property name="hibernate.hbm2ddl.auto" value="create-drop" /> 

But I need to do this manually from the code after the first drop and create happened.

Is it possible? What is the easiest way?

3 Answers
Related