-->
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.  [ 2 posts ] 
Author Message
 Post subject: Help me please, too many connection "sleep"
PostPosted: Fri Oct 12, 2007 9:18 pm 
Newbie

Joined: Fri Oct 12, 2007 8:47 pm
Posts: 5
hello, I have a problem, for all query and transactions, Im have too many connection sleep for long time, that connection dont close....

I using java persistence, mysql 5.0 and java1.6 and tomcat 5.5

example my DAO

public void saveCat(Cat cat) throws ServiceUnavailableException{
EntityManagerFactory emf = InitSessionFactoryManager.getEntityManagerFactory();
EntityManager em = emf.createEntityManager();
EntityTransaction et= em.getTransaction();
et.begin();
em.merge(cat);
et.commit();
em.close();
}

my hibernate.cfg.mxl
--------
<hibernate-configuration>

<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

<!-- thread is the short name for org.hibernate.context.ThreadLocalSessionContext and let Hibernate bind the session automatically to the thread -->
<property name="current_session_context_class">thread</property>

<!--manejo de conexiones -->

<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">2</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.timeout">5</property>
<property name="hibernate.connection.release_mode">after_transaction</property>

<!--cerrar automaticamente la sesion -->
<property name="hibernate.transaction.auto_close_session">true</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="org.hibernate.flushMode">org.hibernate.FlushMode.AUTO</property>

<mapping class="Cat"/>
</session-factory>

</hibernate-configuration>


my cp30.propeties
---------------------------
c3p0.maxConnectionAge=8
c3p0.maxIdleTimeExcessConnections=4




my class Cat

@Entity
@Table(name="Cat")
public class CallManager implements java.io.Serializable{

@Column(name="Name",columnDefinition="varchar(255)",nullable=false)
private String Name
public String getNane() {
return Name;
}

@OneToMany(fetch=FetchType.LAZY, mappedBy="cat", cascade= CascadeType.ALL)
@Cascade({org.hibernate.annotations.CascadeType.ALL})
private java.util.List<Food> foods;
public java.util.List<Food> getFoods) {
return this.foods;
}

}


what happening? what is wrong? helpme please, thankĀ“s


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 04, 2007 7:48 am 
Newbie

Joined: Tue Dec 04, 2007 7:46 am
Posts: 2
got same problem. It appeared after i migrated from java 1.5 to 1.6


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

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.