There should be only one SessionFactory created during your
application's lifecycle (assuming you're using only one database).
On Thu, Apr 10, 2008 at 6:31 AM, tbt <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I'm using a static block to save resources so that hibernate does not have
> to initialize a session each time a transaction needs to be done.
>
> ....................................................................
>
> static SessionFactory sessionFactory;
>
> static
> {
> try
> {
> Configuration hibernateConfig = new Configuration();
> URL cfg =
> HibernateSession.class.getResource("hibernate.cfg.xml");
> sessionFactory =
> hibernateConfig.configure(cfg).buildSessionFactory();
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
> }
>
>
> public Session getHibernateSession()
> {
> return sessionFactory.openSession();
> }
>
> ...........................................................................
>
> Is this method a correct way to integrate hibernate with wicket and also
> saving resources at the same time. (If I create an instance of a
> SessionFactory, the application runs very slowly)
>
> Thanks
> tbt
> --
> View this message in context:
> http://www.nabble.com/Hibernate-with-wicket-tp16607352p16607352.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]