title: cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector
body: <p>In my spring project I am using hibernate for access database..</p>
  
  <p>I have </p>
  
  <pre><code>&lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
          p:dataSource-ref="dataSource" p:packagesToScan-ref="packagesToScan"
          p:hibernateProperties-ref="hibernateProperties" /&gt;
  
      &lt;util:map id="hibernateProperties"&gt;
          &lt;entry key="hibernate.show_sql" value="false" /&gt;
          &lt;!-- &lt;entry key="hibernate.hbm2ddl.auto" value="update" /&gt; --&gt;
          &lt;entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /&gt;
      &lt;/util:map&gt;
  
      &lt;util:list id="packagesToScan"&gt;
          &lt;value&gt;com.preeti.myproject&lt;/value&gt;
      &lt;/util:list&gt;
  
  
      &lt;bean id="transactionManager"
          class="org.springframework.orm.hibernate4.HibernateTransactionManager"
          p:sessionFactory-ref="sessionFactory" /&gt;
  </code></pre>
  
  <p>In pom file I have:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
      &lt;version&gt;4.3.11.Final&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>But when I run that project I am getting error:</p>
  
  <p>Error creating bean with name 'SignupController': </p>
  
  <pre><code>Injection of autowired dependencies failed; 
  nested exception is org.springframework.beans.factory.BeanCreationException:
  Could not autowire field: 
  private com.preeti.myproject.service.UserService 
  com.preeti.myproject.controller.SignupController.userService
   nested exception is org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'userService': 
  Injection of autowired dependencies failed; 
  Could not autowire field:
   private org.hibernate.SessionFactory com.preeti.myproject.hibernate.AbstractHibernateDao.sessionFactory;
  
  nested exception is org.springframework.beans.factory.BeanCreationException:
   Error creating bean with name 'sessionFactory' defined in ServletContext 
  resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; 
  nested exception is java.lang.ClassCastException:
   org.hibernate.annotations.common.reflection.java.JavaReflectionManager
   cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector
  </code></pre>
  
  <p>when I used</p>
  
  <pre><code> hibernate 3.5.0-final,
  hibernate-core-3.5.4-Final,
  hibernate-entitymanager-3.5.4-Final,
  hibernate-commons-annotations-3.3.0.ga
  </code></pre>
  
  <p>that project has no error..</p>
  
  <p>What I have to update to reduce this errors..</p>