title: Spring + Hibernate - Tables are not getting created in MySQL
body: <p>I have configured my web project with Spring and Hibernate. Below is the pom:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.medosa&lt;/groupId&gt;
      &lt;artifactId&gt;MedoSa-backend&lt;/artifactId&gt;
      &lt;version&gt;1&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;name&gt;MedoSa-backend&lt;/name&gt;
      &lt;description&gt;A hand for a needed hand&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;jdk.version&gt;1.8&lt;/jdk.version&gt;
          &lt;spring.version&gt;4.3.4.RELEASE&lt;/spring.version&gt;
          &lt;jackson.version&gt;1.9.13&lt;/jackson.version&gt;
          &lt;hibernate.version&gt;4.3.11.Final&lt;/hibernate.version&gt;
      &lt;/properties&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;JBoss repository&lt;/id&gt;
              &lt;url&gt;http://repository.jboss.com/maven2/&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;4.3.4.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;1.7.3&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.9&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate library dependecy start --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.jolbox&lt;/groupId&gt;
              &lt;artifactId&gt;bonecp&lt;/artifactId&gt;
              &lt;version&gt;0.8.0.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Hibernate framework --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;5.4.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations --&gt;
          &lt;!-- &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
              &lt;version&gt;3.5.6-Final&lt;/version&gt;
          &lt;/dependency&gt; --&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;MedoSa-Backend&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;target&gt;${jdk.version}&lt;/target&gt;
                      &lt;source&gt;${jdk.version}&lt;/source&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>and below is my dispatcher-servlet.xml file:</p>
  
  
  
  <p>http://www.springframework.org/schema/beans
          <a href="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" rel="nofollow noreferrer">http://www.springframework.org/schema/beans/spring-beans-3.1.xsd</a>
          <a href="http://www.springframework.org/schema/context" rel="nofollow noreferrer">http://www.springframework.org/schema/context</a>
          <a href="http://www.springframework.org/schema/context/spring-context.xsd" rel="nofollow noreferrer">http://www.springframework.org/schema/context/spring-context.xsd</a>
          <a href="http://www.springframework.org/schema/tx" rel="nofollow noreferrer">http://www.springframework.org/schema/tx</a>
          <a href="http://www.springframework.org/schema/tx/spring-tx.xsd" rel="nofollow noreferrer">http://www.springframework.org/schema/tx/spring-tx.xsd</a> 
          <a href="http://www.springframework.org/schema/mvc" rel="nofollow noreferrer">http://www.springframework.org/schema/mvc</a>
          <a href="http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd" rel="nofollow noreferrer">http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd</a>"></p>
  
  <pre><code>&lt;context:component-scan base-package="com.medosa" /&gt;
  &lt;mvc:annotation-driven /&gt;
  
  &lt;context:property-placeholder location="classpath:AppConfig.properties" /&gt;
  
  &lt;!-- BoneCP configuration --&gt;
  &lt;bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
      destroy-method="close"&gt;
      &lt;property name="driverClass" value="${db.driverClassName}" /&gt;
      &lt;property name="jdbcUrl" value="${db.url}" /&gt;
      &lt;property name="username" value="${db.username}" /&gt;
      &lt;property name="password" value="${db.password}" /&gt;
      &lt;property name="idleConnectionTestPeriod" value="60" /&gt;
      &lt;property name="idleMaxAge" value="240" /&gt;
      &lt;property name="maxConnectionsPerPartition" value="30" /&gt;
      &lt;property name="minConnectionsPerPartition" value="10" /&gt;
      &lt;property name="partitionCount" value="3" /&gt;
      &lt;property name="acquireIncrement" value="5" /&gt;
      &lt;property name="statementsCacheSize" value="100" /&gt;
      &lt;property name="releaseHelperThreads" value="3" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${db.dialect}&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven /&gt;
  &lt;bean id="transactionManager"
      class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;
  &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;
  &lt;bean id="persistenceExceptionTranslationPostProcessor"
      class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have created my model classes. And annotated them with @Entity. I have set hbm2ddl property also to create. Still whenever I am trying to deploy it in the server it is not generating tables. And there is no errors also.</p>
  
  <p>I tried to search all solutions on google, tried many things but didn't work.
  will be thankful for your kind help</p>