9 Replies Latest reply on Oct 13, 2008 11:36 AM by peterj

    jboss as 5 - hibernate integration help needed

    geckopower

      Hi, I know JBossAS5 - Hibernate integration document is sparse; despite that, I was able to make it somewhat far, hoping for little bit of help to finish it off.

      I got in my "server/default/deploy" directory test.har (contents) as follows:

      +META-INF
      +--------manifest.mf
      +--------service-hibernate.xml
      +com/mycom/persistent/context
      +----------PersistentItem.class & PersistentItem.hbm.xml


      service-hibernate.xml content is:
      (note xml is correct, just not rendering correctly)


      <hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
      <session-factory
      name="java:/ExampleSessionFactory"

      bean="jboss.test.har:service=Hibernate,testcase=TimersUnitTestCase">
      java:/OracleDS
      org.hibernate.dialect.Oracle8iDialect
      <!--
      org.jboss.test.hibernate.SimpleInterceptor
      -->
      jboss:service=Naming
      jboss:service=TransactionManager
      </session-factory>
      </hibernate-configuration>


      in my jsf I can open a session using the code:


      org.hibernate.SessionFactory sf = (org.hibernate.SessionFactory)
      ic.lookup("java:/ExampleSessionFactory");
      org.hibernate.Session s = sf.openSession();
      s.get(com.mycom.persistent.PersistentItem.class, new Long(1));


      but the last line gives me an exception. If i don't include the last line,
      no exception; i can get the sessionfactory just fine. I can also see the jboss AS output in System.out that it was able to bind the sessionfactory to jndi. but when i try to get something, exception:


      An error occurred at line: 42 in the jsp file: /client.jsp
      com.mycom.persistent.PersistentItem cannot be resolved to a type


      how should i be deploying the har file so that my war can see it.
      Note i'm not using ejb's, just plain war. Not at EJB yet.

      Last mile...please help. Just getting a valid SessionFactory was alot of work given the changes between jboss4 and 5 (and the lack of documentation for 5). Help and you will have documented this new deployment here. I'll even write the documentation of the integration for my fellow hibernators.

      And if you can't find the time to help, well thanks for the good work.