title: How to have Hibernate drop and recreate database during runtime, not at compile time?
body: <p>I have a webserver and am prototyping some work with hibernate and spring. I have a Insert method that inserts a bunch of test data. This script kicks off when a certain page on my website is requested by the user. I would like to have the DB dropped and recreated when the user enters this page.</p>
  
  <p>Is there anyway to do this at run time like I am suggesting? I can stop and start my server, but that takes a while.</p>
  
  <p>Update - Here is how I did it:</p>
  
  <pre><code>    Configuration configuration = new Configuration().configure();
      ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
      SchemaExport schemaExport = new SchemaExport(serviceRegistry, configuration);
      schemaExport.create(Target.BOTH);
  </code></pre>