3 Replies Latest reply on May 26, 2009 9:30 AM by yashendrac

    My Hibernate Mapping files NOT loaded in jboss 5

    yashendrac

      I just came to know that my hibernate-service.xml/hibernate configuration from JBoss 4 is not going to work until I make changes as specified here

      http://www.jboss.org/community/wiki/JBossHibernate3

      I did that too but now the problem is that my hibernate mapping xmls -hbm.xml are not getting loaded. Both my ejb and -hbm.xml are bundled in same jar. Even if it is not bundled in same jar it should be loaded. I have not configured this -hbm.xml in new jboss 5 -hibernate.xml as it is not required, also I don't how to configure -hbm.xml explicitly in -hibernate.xml as I am not able to find any schema or DTD related to this xml. here is the content of -hibernate.xml

      <hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
      
       <session-factory name="java:hibernate/SessionFactory" bean="jboss.test.har:service=Hibernate,testcase=TimersUnitTestCase">
       <property name="datasourceName">java:/DefaultDS</property>
       <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
       <property name="sessionFactoryInterceptor">org.jboss.test.hibernate.SimpleInterceptor</property>
       <property name="hbm2ddlAuto">update</property>
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
       </session-factory>
      
      </hibernate-configuration>
      



      And the content of my -hbm.xml

      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping PUBLIC
       "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
      
      <hibernate-mapping>
       <class name="com.safenetinc.smc.objectmanager.system.GlobalProperties" table="smcproperties">
       <id name="dbId" type="java.lang.String" column="name">
       <generator class="assigned"/>
       </id>
       <property name="value" type="java.lang.String" column="value" access="field"/>
       <property name="largeValue" length="70000" access="field"/>
       <!--70000 guarantees clob will be used.-->
       <property name="description" type="java.lang.String" column="descr"/>
       </class>
      </hibernate-mapping>
      


      This is the exception which I think is because my hibernate code is not able to find -hbm.xml

      Caused by: org.hibernate.MappingException: Unknown entity: com.safenetinc.smc.objectmanager.system.GlobalProperties
       at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
      


      Any Idea?