-->
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: Spring - Hibernate - Struts - Mysql Connection explosion
PostPosted: Mon Feb 28, 2011 8:58 am 
Newbie

Joined: Mon Feb 28, 2011 8:48 am
Posts: 1
Hello,

For the moment I'm developing a webshop, the architecture is based on Spring - Hibernate - Struts & Mysql. After ... minutes I get an "explosion" of open databaseconnection. I tried the c3p0 connection pool also but that gives the same problems (crasch of application after several minutes). I got the best result with following configuration : (but still connection explosion).


jdbc.properties file
hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost:3306/rdcoshop?autoReconnect=true
hibernate.connection.username rdcoshop
hibernate.connection.password rdcoshop


jdbc.properties file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ========================================================== PROPERTY CONF-->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:jdbc.properties"/>
</bean>

<!-- ========================================================== DATASOURCE -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${hibernate.connection.driver_class}"/>
<property name="url" value="${hibernate.connection.url}"/>
<property name="username" value="${hibernate.connection.username}"/>
<property name="password" value="${hibernate.connection.password}"/>
</bean>

<!-- ========================================================== HIBERNATE -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>

<property name="mappingResources">
<list>
<value>Users.hbm.xml</value>
</list>
</property>

<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</prop>
<prop key="hibernate.max_fetch_depth">1</prop>
</props>
</property>
</bean>

<!-- ========================================================== TRANSACTIONS -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>

<bean id="rightDAO" class="db.persistence.RightDAOImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>


</beans>



Does anyone know if this is a general problem between spring - hibernate & mysql ? Can anyone give me the ideal setup?

Thanks for your help !!!


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.