title: Class is managed, but is not listed in the persistence.xml file
body: <p>I am getting the following exception in my project:</p>
  
  <blockquote>
    <p>Class "com.testApp.domain.Register" is managed, but is not listed in the persistence.xml file</p>
  </blockquote>
  
  <p>My <code>persistence.xml</code> file looks like that:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0"
      xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
  
      &lt;persistence-unit name="default" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.archive.detection" value="class, hbm" /&gt;
              &lt;property name="hibernate.show_sql" value="true" /&gt;
              &lt;property name="hibernate.format_sql" value="true" /&gt;
  
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
  
              &lt;property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" /&gt;
              &lt;property name="hibernate.connection.url" value="jdbc:hsqldb:mem:." /&gt;
              &lt;property name="hibernate.connection.username" value="SA" /&gt;
              &lt;property name="hibernate.connection.password" value="" /&gt;
  
              &lt;property name="hibernate.c3p0.min_size" value="5" /&gt;
              &lt;property name="hibernate.c3p0.max_size" value="20" /&gt;
              &lt;property name="hibernate.c3p0.timeout" value="300" /&gt;
              &lt;property name="hibernate.c3p0.max_statements" value="50" /&gt;
              &lt;property name="hibernate.c3p0.idle_test_period" value="3000" /&gt;
  
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p>I have tried this <a href="https://stackoverflow.com/questions/2242637/class-model-address-is-listed-in-the-persistence-xml-file-but-not-mapped">post</a> and <a href="https://stackoverflow.com/questions/18051055/must-every-entity-bean-be-registered-in-persistence-xml">this</a>, both suggest to add the class manually or automatically to the <code>persistence.xml</code>. Others say its a eclipse related issue and can be solved by cleaning or reopening of the project. However, I want that these classes get autodetected by hibernate and not manually add them to my <code>persistence.xml</code>.</p>
  
  <p>Any suggestions for a solution and to solve my error?</p>
  
  <p>I appreciate your reply!</p>
  
  <p>UPDATE</p>
  
  <p>My <code>applicationContext.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:security="http://www.springframework.org/schema/security"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:jee="http://www.springframework.org/schema/jee"
      xsi:schemaLocation="
                          http://www.springframework.org/schema/beans 
                          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                          http://www.springframework.org/schema/context
                          http://www.springframework.org/schema/context/spring-context-3.0.xsd
                          http://www.springframework.org/schema/tx 
                          http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                          http://www.springframework.org/schema/aop 
                          http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                          http://www.springframework.org/schema/jee 
                          http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
                          http://www.springframework.org/schema/security
                          http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt;
  
      &lt;context:component-scan base-package="com.testApp" annotation-config="true" /&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt;
  
      &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
          &lt;property name="persistenceUnitName" value="default" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean"&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  
  &lt;/beans&gt;
  </code></pre>