-->
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: multiply prepared statement
PostPosted: Thu May 19, 2005 4:25 pm 
Beginner
Beginner

Joined: Fri Dec 17, 2004 8:30 pm
Posts: 20
What does the following warning message mean? It started showing up after I changed the query to use "and up.objTypeId in (:objTypeIds)" instead of "and up.objTypeId=:objTypeId".


WARN [2005-05-19 13:21:58,796] com.mchange.v2.c3p0.stmt.GooGooStatementCache.assimilateNewCheckedOutStatement(GooGooStatementCache.java:300)(GooGooStatementCache.java300): -------> Multiply prepared statement! select userprivil0_.id as col_0_0_ from know.userprivilege userprivil0_ where userprivil0_.unum=? and (userprivil0_.objType in (?)) and userprivil0_.priv=?


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.2

Mapping documents:

<query name="com.knowlist.list.hh.UserPrivilege.findByUnumObjType">
<![CDATA[
from com.knowlist.list.hh.UserPrivilege up
where
up.unum=:unum
and up.objTypeId in (:objTypeIds)
and up.privId=:privId
]]>
</query>


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 1:09 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
mxnmatch,

this is not necessarily a problem, just unusual. (i'll change its logging to INFO rather than WARNING.)

what it means is that the same statement has already been prepared by this Connection, and that this other instance has not yet been closed, so the statement pool has to prepare a second PreparedStatement object rather than reusing the previously-cached Statement. The duplicate Statement will be cached, in case you frequently need multiple instances of this PreparedStatement open simultaneously.

it might indicate a problem, in that you or hibernate or somebody may not be closing PreparedStatements after use, which would delay Statement check-in until Connection close, and make these messages come up every time you prepare the same SQL twice on the same open Connection. But it might well be that your app just wants two PreparedStatement objects based in the same SQL (and other params, and from the same cxn) open at the same time, which is perfectly legit.

perhaps you simply happened to change your query to HQL that translates into the same SQL text that appears or is autogenerated elsewhere, and hibernate is keeping all the prepared statements it's gonna need open for the duration of a session? if so, that's not a problem.

smiles,
Steve (c3p0 guy)


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.