text: Q:
  
  Spring + Hibernate: Create database from DDL rather than using annotated model classes
  
  Objective
  I am trying to setup a test environment for a Spring and Hibernate based web application, using an in memory database which is currently automatically created based on provided annotated model classes.
  Problem
  Rather than using the model classes to create the database, Hibernate should use a DDL file to create the database. 
  Question
  Is this possible and if the answer is 'Yes', how could I achive this? 
  
  A:
  
  Yes, you can generate a database from SQL file (rather than DDL).
  Once you have created your dataSource bean (I'm assuming in the XML file) just add the following 
  <jdbc:initialize-database data-source="dataSource">
      <jdbc:script location="classpath:/location/of/your/sql/script" />
  </jdbc:initialize-database>
  
  You can include as many jdbc:script's as you like, and can even specify if they are to be used in the creation or destruction of your database.
  Have a look here for more informaton.
  
  