getEntityManager inserirndo linhas idle no banco
Boa noite Pessoal
após passar pelo getEntityManager() no metodo lstNoticia, citado abaixo; são criadas mais 3 linhas na pg_stat_activity
o correto não era pra ser apenas mais 1?
o meu persistence está assim:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="news" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.org.hulk.sistema.bean.Noticia</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/NEWS" />
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="postgres" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.default_schema" value="news" />
<property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
</properties>
</persistence-unit>
</persistence>
estou executando a consulta assim:
public void lstNoticia(){
EntityManager em = getEntityManager();
try{
EasyCriteria<Noticia> ec = EasyCriteriaFactory.createQueryCriteria(em, Noticia.class);
List<Noticia> nots = ec.getResultList();
for (Noticia noticia : nots) {
System.out.println(noticia.getIsnNoticia());
System.out.println(noticia.getDscNoticia());
System.out.println(noticia.getIsnTipoNoticia());
}
}catch(Exception e){
}finally{
em.close();
}
após passar pelo getEntityManager() no metodo lstNoticia, citado abaixo; são criadas mais 3 linhas na pg_stat_activity
o correto não era pra ser apenas mais 1?
o meu persistence está assim:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="news" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.org.hulk.sistema.bean.Noticia</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/NEWS" />
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="postgres" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.default_schema" value="news" />
<property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
</properties>
</persistence-unit>
</persistence>
estou executando a consulta assim:
public void lstNoticia(){
EntityManager em = getEntityManager();
try{
EasyCriteria<Noticia> ec = EasyCriteriaFactory.createQueryCriteria(em, Noticia.class);
List<Noticia> nots = ec.getResultList();
for (Noticia noticia : nots) {
System.out.println(noticia.getIsnNoticia());
System.out.println(noticia.getDscNoticia());
System.out.println(noticia.getIsnTipoNoticia());
}
}catch(Exception e){
}finally{
em.close();
}
Barcelos.java
Curtidas 0