[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Using Hibernate's ScanForMappingsEnabled

homerlex do-not-reply at jboss.com
Fri Sep 7 09:33:28 EDT 2007


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?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082156#4082156

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082156



More information about the jboss-user mailing list