2 Replies Latest reply on Mar 21, 2009 7:26 PM by zmicer

    Session always return null (@In)

    guga.java

      I can not do inject a Seam Session for me to hibernate, follow the documentation and nothing!
      Please help me something, I stopped the project because of it ...
      Here is my part of my components.xml:


      <persistence:hibernate-session-factory auto-create="true"
        name="sessionFactory" scope="application"/>
       <persistence:managed-hibernate-session auto-create="true"
        name="session" session-factory="#{sessionFactory}"/>
       <transaction:hibernate-transaction session="#{session}"/>




      In my code I use @ In Session session and he always returns null, which is that I can be doing wrong?

        • 1. Re: Session always return null (@In)
          norman

          Try naming your hibernate session as something other than session and see if that solves your problem.

          • 2. Re: Session always return null (@In)
            zmicer

            Please find my thoughts on a way to understand what problem is and confirm Norman's notes.


            try in debug mode the following expression (in Eclipse debug mode and expressions view )



            Component.getInstance("session")



            This code would try to create component with the name session. At the expressions view you would be able to see instance of which class is returned. It would answers if your component is instantiated correctly.


            Kind regards,
            Dzmitry