-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: To many connections on load
PostPosted: Thu Nov 19, 2009 5:27 pm 
Newbie

Joined: Thu Nov 19, 2009 5:16 pm
Posts: 2
Im new using hibernate..I created a small applications usinf richfaces, jsf, hibernate...

Its working, but when I check the list of connections to Postgresql, my application generates to many..why? do I need to configure something in hibernate?

this is my bean that popules a rich:dataTable

Code:
public class DatosListaBean {
   private List<Casos_soporte> listaDatos;
   private static SessionFactory sessionFactory;

public void cargarLista(){
   sessionFactory=new Configuration().configure().buildSessionFactory();
   Session sesion=sessionFactory.openSession();
        listaDatos= (List<Casos_soporte>)(sesion.createQuery("from Casos_soporte").list());
   sesion.close();
}
public List<Casos_soporte> getListaDatos() {
   cargarLista();
   return listaDatos;
}
   public void setListaDatos(List<Casos_soporte> listaDatos) {
      this.listaDatos = listaDatos;
   }
}


This is my cfg.xml file

Code:
<session-factory>
  <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
  <property name="hibernate.connection.url">jdbc:postgresql://localhost/xxx</property>
  <property name="hibernate.connection.username">xxx</property>
  <property name="hibernate.connection.password">xxx</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="hibernate.hbm2ddl.auto" >update</property>
  <mapping resource="persistencia/casos_soporte.hbm.xml"/>
</session-factory>


how can i configure this so that it wont create 5+ connections to my DB..every time the page loads..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.