-->
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: MaxOpenPreparedStatements limit reached
PostPosted: Tue Mar 09, 2004 6:06 am 
Newbie

Joined: Tue Mar 09, 2004 5:38 am
Posts: 1
Location: Austria
Hi, everybody!

After updating from 2.1.1 to 2.1.2 I'm facing the following Exception:

10:46:48,031 ERROR JDBCExceptionReporter:46 - MaxOpenPreparedStatements limit reached
10:46:48,041 ERROR JDBCExceptionReporter:38 - could not insert: [com.soultec.trueAct.objects.service.TxtI18N]
org.apache.commons.dbcp.SQLNestedException: MaxOpenPreparedStatements limit reached, cause:
java.util.NoSuchElementException
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:803)
at org.apache.commons.dbcp.PoolingConnection.prepareStatement(PoolingConnection.java:130)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:216)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:323)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:505)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1359)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:761)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)
...
--------------------------------------------------------------------------------
I have to be very restrictive with PreparedStatement pooling, so I defined in the hibernate.cfg.xml:

<property name="dbcp.ps.maxActive">10</property>
<property name="dbcp.ps.whenExhaustedAction">0</property>

<property name="dbcp.ps.maxWait">10000</property>
<property name="dbcp.ps.maxIdle">5</property>


I'm trying to save a lot of different parent objects:

for ( x times)
{
... // produce parent/children

hibernateSession.save(parent); <<<<< Exception after approximately 10 iterations
if (service.getChildren()==null) continue;

Iterator it = parent.getChildren().iterator();
while (it.hasNext())
{
Child child = (Child)it.next();
hibernateSession.save(child);
}

}
hibernateSession.flush();


using these mappings

<class table="parent" name="Parent">
<id unsaved-value="0" column="rid" type="int" name="rid">
<generator class="assigned"/>
</id>
<property .....>
<set name="txtI18NSet" table="ttxti18n" cascade="all" inverse="true" >
<key column="serviceid"/>
<one-to-many class="Child"/>
</set>
</class>

<class table="child" name="Child">
<id unsaved-value="0" column="rid" type="int" name="rid">
<generator class="identity"/>
</id>
<many-to-one name="parent" column="serviceid" class="Parent" not-null="true"/>
<property type="string" column="txt" name="txt"/>
<property type="string" column="label" name="label"/>
</class>

Thanks
Hans[/b]


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.