-->
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: Hibernate Connection Pooling
PostPosted: Fri Sep 24, 2004 1:21 pm 
Newbie

Joined: Fri Sep 24, 2004 1:15 pm
Posts: 1
Posted: Fri Sep 24, 2004 11:57 am Post subject: Hibernate Connection Pooling

--------------------------------------------------------------------------------

Hi,

Before I start describing my issue, I should mention that I am relatively new to hibernate ..

We are developing a spring + hibernate application. We have our application setup such that we do not explicitly manage transactions (we let spring manage it for us).

I am trying to configure connection pooling and towards this I have set the appropriate c3p0 properties (applicationcontext.xml pasted at the end of this mail). But everytime I issue a database command it seems to me that spring is creating a new connection... (Message from log pasted below)

Sep 24, 2004 11:00:20 AM org.springframework.jdbc.datasource.DriverManagerDataSource getConnectionFromDriverManager
INFO: Creating new JDBC connection to [jdbc:oracle:thin:@dev.xyz.com:1521:dev1]

Why is a new JDBC connection being created each time ? What am I doing worng?

Best Regards
Ankur

Relevant sections of my applicationcontext.xml are pasted below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"> <ref local="dataSource"/> </property>
<property name="mappingResources">
<list>
<value>com/mtgi/cciaws/model/User.hbm.xml</value>
<value>com/mtgi/cciaws/model/ResourceGroup.hbm.xml</value>
<value>com/mtgi/cciaws/model/Company.hbm.xml</value>
<value>com/mtgi/cciaws/model/Usersresgrpxref.hbm.xml</value>
<value>com/mtgi/cciaws/model/Product.hbm.xml</value>
<value>com/mtgi/cciaws/model/Productattributes.hbm.xml</value>
<value>com/mtgi/cciaws/model/Productdependencies.hbm.xml</value>
<value>com/mtgi/cciaws/model/Package.hbm.xml</value>
<value>com/mtgi/cciaws/model/Attribute.hbm.xml</value>
<value>com/mtgi/cciaws/model/Attributevalues.hbm.xml</value>
<value>com/mtgi/cciaws/model/Security.hbm.xml</value>
<value>com/mtgi/cciaws/model/Packageproductxref.hbm.xml</value>
<value>com/mtgi/cciaws/model/Transactionlog.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.c3p0.minPoolSize">5</prop>
<prop key="hibernate.c3p0.maxPoolSize">20</prop>
<prop key="hibernate.timeout">1800</prop>
<prop key="hibernate.max_statement">50</prop>
</props>
</property>
</bean>
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/> </property>
</bean>

<!-- BEGIN User Bean Definition -->
<bean id="userDAO" class="com.mtgi.cciaws.dao.hibernate.UserDAOHibernate">
<property name="sessionFactory"><ref local="sessionFactory"/> </property>
</bean>

<bean id="userManagerTarget" class="com.mtgi.cciaws.service.impl.UserManagerImpl">
<property name="userDAO"><ref local="userDAO"/> </property>
<property name="validator"><ref bean="userValidator"/> </property>
</bean>

<bean id="userValidator" class="com.mtgi.cciaws.web.UserValidator"/>

<bean id="userManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/> </property>
<property name="target"><ref local="userManagerTarget"/> </property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- END User Bean Definition -->

</beans>


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.