1 Reply Latest reply on Sep 7, 2007 9:37 AM by homer homer

    Using Hibernate's ScanForMappingsEnabled

    homer homer Newbie

      I have an EAR that contains a WAR and HAR. The HAR only contains the hibernate-service.xml which looks like this:

      <server>
       <mbean code="org.jboss.hibernate.jmx.Hibernate"
       name="test.messaging:name=MessagingSessionFactory">
       <attribute name="DatasourceName">java:/MySqlDS</attribute>
       <attribute name="Dialect">
       org.hibernate.dialect.MySQLDialect
       </attribute>
       <attribute name="SessionFactoryName">
       java:/hibernate/MessagingSessionFactory
       </attribute>
       <attribute name="CacheProviderClass">
       org.hibernate.cache.HashtableCacheProvider
       </attribute>
       <attribute name="ShowSqlEnabled">true</attribute>
       <attribute name="ScanForMappingsEnabled">true</attribute>
       </mbean>
      </server>
      


      The WAR has some servlets and also has a jar (in WEB-INF) that contains the hibernate mapping and class files.

      When the servlet tries to do a save with one of these hibernate objects I get an exception: org.hibernate.MappingException: Unknown entity

      I looked at the Jboss logs when the EAR deploys and it appears that the ONLY place being searched for the hibernate mappings is in the HAR file:

      2007-09-07 09:11:30,627 INFO [org.hibernate.cfg.Configuration] Searching for mapping documents in jar: tmp3596messagebrokerpersistence.har
      


      It is my understanding that with ScanForMappingsEnabled set to true its supposed to scan the entire EAR for the mapping files. Am I missing something or doing something wrong?