2 Replies Latest reply on Nov 12, 2008 3:25 PM by Tamas Malatinszki

    convertEntity + Seam + Hibernate EJB Container Transaction

    Pedro Busko Newbie

      Hi, folks!


      I'm a newbie in Seam, and I need some Help...I'm using:


      Eclipse with JBoss Tools
      JBoss 4.2.3GA
      Seam 2.0.1
      Hibernate3 with EJB container managed transaction



      I'm trying to use this:


      my page:


      <h:selectOneMenu id="select_mybject" value="#{myObject}">
          <s:selectItems value="#{myListofMyObject}" 
                  var="myobject" label="#{myobject.name}" 
                  noSelectionLabel="Select something"/>
          <s:convertEntity/>
                                              
      </h:selectOneMenu>



      components.xml:



      <persistence:hibernate-session-factory name="sisgpSessionFactory" 
                                                                      cfg-resource-name="/config/hibernate.cfg.xml"/>
      
              <persistence:managed-hibernate-session name="hibernateSession" 
                                      auto-create="true"
                        session-factory-jndi-name="java:/sisgpSessionFactory"/>
      
              <transaction:hibernate-transaction session="#{hibernateSession}"/>
      
              <component name="org.jboss.seam.ui.EntityConverter">
                      <property name="session">#{hibernateSession}</property>
              </component>



      my exception:


      org.hibernate.TransientObjectException: The instance was not associated with this session
              at org.hibernate.impl.SessionImpl.getIdentifier(SessionImpl.java:1375)
              at org.jboss.seam.persistence.HibernateSessionProxy.getIdentifier(HibernateSessionProxy.java:236)
              at org.jboss.seam.framework.HibernateEntityIdentifier.<init>(HibernateEntityIdentifier.java:13)
              at org.jboss.seam.ui.converter.entityConverter.HibernateEntityLoader.createIdentifier(HibernateEntityLoader.java:39)
              at org.jboss.seam.ui.converter.entityConverter.AbstractEntityLoader.put(AbstractEntityLoader.java:50)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ...