2 Replies Latest reply on Oct 24, 2007 9:55 AM by Joseph Celano

    Using s:convertEntity with Hibernate and no EJB

    Joseph Celano Newbie

      I am using Seam 2.0 CR2 with Jboss 4.2. Our application is a simple web application that is deployed as a WAR file and uses Hibernate for persistence. My questions are:

      1. Can i use the s:convertEntity tag if i am using simple Hibernate for my persistence in a WAR file (i.e. no EJB stuff)?
      2. If so, how? Or where is a good example of this? Or where is this documented?

      I have tried to follow the directions in the PDF documentation (sections 8.2 and the tag reference), but i get the following exception, when i access the web page.

      java.lang.ClassCastException: org.jboss.seam.persistence.HibernateSessionProxy cannot be cast to javax.persistence.EntityManager


      My components.xml file snippet looks like this:
      <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
      
       <persistence:managed-hibernate-session name="netkeySession"
       session-factory="#{hibernateSessionFactory}" auto-create="true"/>
      
       <transaction:hibernate-transaction session="#{netkeySession}"/>
      
       <component name="org.jboss.seam.ui.EntityConverter">
       <property name="entityManager">#{netkeySession}</property>
       </component>


      I am pretty sure that the EntityConverter component is not correct, b/c the HibernateSession cannot be the entityManager, but i couldn't figure out what to put there instead.

      Any help or pointers would be greatly appreciated,

      thx

      Joe C