6 Replies Latest reply on Dec 7, 2006 3:01 AM by thejavafreak

    Create Session Factory

    thejavafreak

      Dear all,

      Would it be possible for me to create hibernate session factory from microcontainer? If it is can anybody give me a hint to achieve that?

      Cheers

        • 1. Re: Create Session Factory
          vickyk

          I don?t know what hibernate session factory does but you can have a POJO which encapsulates the functionality of creating the session factory . This POJO needs to defined in the jboss-beans.xml file and deployed in the kernel, this is done by bootstrapping.
          You got to refer to this link to know how to use the POJO which are deployed in the kernel
          http://docs.jboss.org/nightly/microkernel/docs/gettingstarted/en/html/

          • 2. Re: Create Session Factory
            thejavafreak

            I am thinking that microcontainer can inject Hibernate to create Session Factory. Then I can use the session factory bean from my application. I don't know whether this is possible using microcontainer.

            But based on your explanation I have to create a POJO that create the Session Factory? Or am I missing on something from your statement?

            • 3. Re: Create Session Factory
              vickyk

              Yes it is basically the POJO you will have to create. There are the changes that you can configure most of the java class using the MC, these java classes should be designed as POJO.

              Please refer to the samples at the link which I have passed to you.

              I think you can have a POJO which is just a wrapper over the existing Hibernate related class, it would yield more maintainability and control to you .
              Can you tell me what exactly are you doing with MC , are you just playing with it or you are incorporating this in a real application?

              • 4. Re: Create Session Factory
                thejavafreak

                 

                "vickyk" wrote:
                Can you tell me what exactly are you doing with MC , are you just playing with it or you are incorporating this in a real application?

                Currently I'm still playing with it. I got this idea from Spring, where Spring manage the session factory bean. If MC can do the same thing, I might incorporate MC in my application rather that Spring since the app server is using JBoss anyway.


                • 5. Re: Create Session Factory
                  vickyk

                  My understanding is that MC is meant to be used internally by JBOSS , if you are plans to replace the spring can you look at the jboss Seam framework in your application .

                  • 6. Re: Create Session Factory
                    thejavafreak

                    Thanks for the explanation vickyk. You're a real deal.