2 Replies Latest reply on Jun 24, 2009 4:01 PM by Berkay Aktan

    Seam - Spring integration & s:convertEntity

    Berkay Aktan Newbie

      Hi all..
      Is there any way to use s:convertEntity in a spring managed seam application ?


      I have a core spring project which includes services and daos.I m using seam instead of raw jsf or jsf-spring integration.


      I am getting TransientObjectException: The instance was not associated with this session when i want to use s:convertEntity converter.


      Here is my conf.


      components.xml


      <core:init transaction-management-enabled="false" debug="true" />
      
      <spring:context-loader config-locations="classpath:applicationContext-core.xml" />
      
      <spring:spring-transaction platform-transaction-manager="#{txManager}" />
      
      <persistence:managed-hibernate-session name="managedHibernateSession" session-factory="#{sessionFactory}" auto-create="true"/>
      
      <ui:hibernate-entity-loader session="#{managedHibernateSession}"/>



      applicationContext-core.xml




      <tx:annotation-driven transaction-manager="txManager" />
      
      <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" name="template">
      <property name="sessionFactory" ref="sessionFactory" />
      </bean>
      
      <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory" />
      </bean>
      
      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" depends-on="annotatedClassRegistrar">
      <property name="dataSource" ref="dataSource" />
      <property name="annotatedClasses" ref="annotatedClassList" />
      <property name="hibernateProperties">
      <props>
      <prop key="hibernate.dialect">${database.dialect}</prop>
      <prop key="hibernate.show_sql">${database.show_sql}</prop>
      <prop key="hibernate.format_sql">false</prop>
      <prop key="hibernate.generate_statistics">true</prop>
      </props>
      </property>
      </bean>
      



      managed bean




      @In("#{userAccountService}")
      private UserAccountService userAccountService;
      
      @Factory("users")
      public List<UserAccount> getUsers() {
      return userAccountService.findAll();
      }



      and the presentation..



      <h:selectOneMenu value="#{testAction.test.userAccount}" required="true">
      <s:selectItems var="u" value="#{users}" noSelectionLabel="please select" label="#{u.username}"/>
      <s:convertEntity/>
      </h:selectOneMenu>



      can u help me with this issue ??


      thanks in advance..