0 Replies Latest reply on May 5, 2009 7:05 AM by Adam Basori

    Jboss Seam and Hibernate Shards integration problem

    Adam Basori Newbie
      Hi guys,

      i'm a JBoss Seam newbie from Indonesia. i've problem with Seam & Shards integration. may be you guys can help me or giving any advice and solution.
      i have been searching solution in order to integrate Jboss Seam & Hibernate Shards. My approach is to force Seam to reborn it's SessionFactory using my own component. i dont know if it helps, but here is my approach:

      @Name("SessionReborn")
      public class SessionReborn
      {
           private ValueExpression<SessionFactory> HSF; /* Hibernate Session Factory */

           @Create
           public void birth()
           {     
                  try {  
                         SessionFactory factory = HSF.getValue();
                         factory = new Configuration().addResource( "hibernate.cfg.xml" ).buildSessionFactory();
                  } catch(HibernateException hx) { }
           }
      }|

      then i register the component in components.xml :
          .....
          <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
        
          <component name="SessionReborn">
              <property name="HSF">#{hibernateSessionFactory}</property>
          </component>
          .....

      i thought it will works, but hibernate always throw Exception. it always complain about Dialect, however i have written my hibernate dialect property value in hibernate.cfg.xml properly as well.

      Do the reborn of Seam's SessionFactory have any post/side effects, since it will override all previous Seam workflow out put in SessionFactory? should i re-bootstrap ?

      Please kindly help. Thanks in advance and sorry for bad English