-->
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: Prepared Statement Cache?
PostPosted: Wed Oct 26, 2005 12:57 am 
Newbie

Joined: Mon Oct 24, 2005 6:43 am
Posts: 6
Hi

I am using hibernate-3.1rc2 testcases Source: test\org\hibernate\test\cascade.

Question: How to cache PreparedStatements? I am using the default settings that are bundled with the binaries.

Please see the log below.

10:08:41,966 INFO SchemaExport:200 - schema export complete
10:08:41,976 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
10:08:41,976 INFO Configuration:1014 - processing extends queue
10:08:41,996 INFO Configuration:1018 - processing collection mappings
10:08:41,996 INFO Configuration:1027 - processing association property references
10:08:42,006 INFO Configuration:1049 - processing foreign key constraints
10:08:42,006 DEBUG Configuration:1100 - resolving reference to class: org.hibernate.test.cascade.JobBatch
10:08:42,006 INFO Configuration:1014 - processing extends queue
10:08:42,016 INFO Configuration:1018 - processing collection mappings
10:08:42,016 INFO Configuration:1027 - processing association property references
10:08:42,016 INFO Configuration:1049 - processing foreign key constraints
10:08:42,016 DEBUG Configuration:1100 - resolving reference to class: org.hibernate.test.cascade.JobBatch
10:08:42,016 INFO SessionFactoryImpl:432 - Checking 0 named queries
10:08:42,557 DEBUG SessionImpl:271 - opened session at timestamp: 4629715034382336
10:08:42,607 DEBUG JDBCTransaction:54 - begin
10:08:42,607 DEBUG ConnectionManager:302 - opening JDBC connection
10:08:42,617 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
10:08:42,617 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
10:08:42,617 DEBUG JDBCTransaction:59 - current autocommit status: false
10:08:42,617 DEBUG JDBCContext:204 - after transaction begin
10:08:42,707 DEBUG AbstractSaveEventListener:461 - transient instance of: org.hibernate.test.cascade.JobBatch
10:08:42,727 DEBUG DefaultPersistEventListener:124 - saving transient instance
10:08:42,787 DEBUG AbstractSaveEventListener:139 - saving [org.hibernate.test.cascade.JobBatch#<null>]
10:08:42,787 DEBUG AbstractSaveEventListener:221 - executing insertions
10:08:42,857 DEBUG Cascade:237 - processing cascade ACTION_PERSIST for: org.hibernate.test.cascade.JobBatch
10:08:42,857 DEBUG Cascade:259 - done processing cascade ACTION_PERSIST for: org.hibernate.test.cascade.JobBatch
10:08:42,997 DEBUG WrapVisitor:87 - Wrapped collection in role: org.hibernate.test.cascade.JobBatch.jobs
10:08:43,128 DEBUG AbstractEntityPersister:1940 - Inserting entity: org.hibernate.test.cascade.JobBatch (native id)
10:08:43,128 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,148 DEBUG SQL:344 -
insert
into
T_JOB_BATCH
(BATCH_DATE, BATCH_ID)
values
(?, null)
10:08:43,148 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,168 DEBUG AbstractEntityPersister:1820 - Dehydrating entity: [org.hibernate.test.cascade.JobBatch#<null>]
10:08:43,178 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,188 DEBUG AbstractBatcher:459 - closing statement
10:08:43,188 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,188 DEBUG SQL:344 -
call identity()
10:08:43,198 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,198 DEBUG IdentifierGeneratorFactory:37 - Natively generated identity: 1
10:08:43,198 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,198 DEBUG AbstractBatcher:459 - closing statement
10:08:43,278 DEBUG Cascade:237 - processing cascade ACTION_PERSIST for: org.hibernate.test.cascade.JobBatch
10:08:43,288 DEBUG Cascade:285 - cascade ACTION_PERSIST for collection: org.hibernate.test.cascade.JobBatch.jobs
10:08:43,308 DEBUG CascadingAction:201 - cascading to persist: org.hibernate.test.cascade.Job
10:08:43,308 DEBUG AbstractSaveEventListener:461 - transient instance of: org.hibernate.test.cascade.Job
10:08:43,308 DEBUG DefaultPersistEventListener:124 - saving transient instance
10:08:43,308 DEBUG AbstractSaveEventListener:139 - saving [org.hibernate.test.cascade.Job#<null>]
10:08:43,328 DEBUG AbstractSaveEventListener:221 - executing insertions
10:08:43,328 DEBUG AbstractEntityPersister:1940 - Inserting entity: org.hibernate.test.cascade.Job (native id)
10:08:43,328 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,348 DEBUG SQL:344 -
insert
into
T_JOB
(BATCH_ID, JOB_STATUS, PI, JOB_ID)
values
(?, ?, ?, null)

10:08:43,348 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,348 DEBUG AbstractEntityPersister:1820 - Dehydrating entity: [org.hibernate.test.cascade.Job#<null>]
10:08:43,348 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,358 DEBUG AbstractBatcher:459 - closing statement
10:08:43,358 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,358 DEBUG SQL:344 -
call identity()
10:08:43,358 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,368 DEBUG IdentifierGeneratorFactory:37 - Natively generated identity: 1
10:08:43,368 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,368 DEBUG AbstractBatcher:459 - closing statement
10:08:43,368 DEBUG CascadingAction:201 - cascading to persist: org.hibernate.test.cascade.Job
10:08:43,378 DEBUG AbstractSaveEventListener:461 - transient instance of: org.hibernate.test.cascade.Job
10:08:43,378 DEBUG DefaultPersistEventListener:124 - saving transient instance
10:08:43,378 DEBUG AbstractSaveEventListener:139 - saving [org.hibernate.test.cascade.Job#<null>]
10:08:43,378 DEBUG AbstractSaveEventListener:221 - executing insertions
10:08:43,388 DEBUG AbstractEntityPersister:1940 - Inserting entity: org.hibernate.test.cascade.Job (native id)
10:08:43,388 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,388 DEBUG SQL:344 -
insert
into
T_JOB
(BATCH_ID, JOB_STATUS, PI, JOB_ID)
values
(?, ?, ?, null)

10:08:43,388 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,388 DEBUG AbstractEntityPersister:1820 - Dehydrating entity: [org.hibernate.test.cascade.Job#<null>]
10:08:43,398 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,398 DEBUG AbstractBatcher:459 - closing statement
10:08:43,398 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
10:08:43,398 DEBUG SQL:344 -
call identity()
10:08:43,408 DEBUG AbstractBatcher:413 - preparing statement
10:08:43,408 DEBUG IdentifierGeneratorFactory:37 - Natively generated identity: 2
10:08:43,408 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:08:43,408 DEBUG AbstractBatcher:459 - closing statement
10:08:43,438 DEBUG Cascade:300 - done cascade ACTION_PERSIST for collection: org.hibernate.test.cascade.JobBatch.jobs
10:08:43,438 DEBUG Cascade:259 - done processing cascade ACTION_PERSIST for: org.hibernate.test.cascade.JobBatch
10:08:43,438 DEBUG AbstractFlushingEventListener:58 - flushing session
10:08:43,478 DEBUG AbstractFlushingEventListener:111 - processing flush-time cascades
10:08:43,498 DEBUG Cascade:237 - processing cascade ACTION_SAVE_UPDATE for: org.hibernate.test.cascade.JobBatch
10:08:43,498 DEBUG Cascade:285 - cascade ACTION_SAVE_UPDATE for collection: org.hibernate.test.cascade.JobBatch.jobs
10:08:43,508 DEBUG CascadingAction:133 - cascading to saveOrUpdate: org.hibernate.test.cascade.Job
10:08:43,508 DEBUG AbstractSaveEventListener:435 - persistent instance of: org.hibernate.test.cascade.Job
10:08:43,508 DEBUG DefaultSaveOrUpdateEventListener:105 - ignoring persistent instance
10:08:43,508 DEBUG DefaultSaveOrUpdateEventListener:142 - object already associated with session: [org.hibernate.test.cascade.Job#1]
10:08:43,508 DEBUG CascadingAction:133 - cascading to saveOrUpdate: org.hibernate.test.cascade.Job
10:08:43,518 DEBUG AbstractSaveEventListener:435 - persistent instance of: org.hibernate.test.cascade.Job
10:08:43,518 DEBUG DefaultSaveOrUpdateEventListener:105 - ignoring persistent instance
10:08:43,518 DEBUG DefaultSaveOrUpdateEventListener:142 - object already associated with session: [org.hibernate.test.cascade.Job#2]
10:08:43,518 DEBUG Cascade:300 - done cascade ACTION_SAVE_UPDATE for collection: org.hibernate.test.cascade.JobBatch.jobs
10:08:43,528 DEBUG Cascade:259 - done processing cascade ACTION_SAVE_UPDATE for: org.hibernate.test.cascade.JobBatch
10:08:43,528 DEBUG AbstractFlushingEventListener:153 - dirty checking collections
10:08:43,528 DEBUG AbstractFlushingEventListener:170 - Flushing entities and processing referenced collections
10:08:43,668 DEBUG Collections:159 - Collection found: [org.hibernate.test.cascade.JobBatch.jobs#1], was: [<unreferenced>] (initialized)
10:08:43,668 DEBUG AbstractFlushingEventListener:209 - Processing unreferenced collections
10:08:43,668 DEBUG AbstractFlushingEventListener:223 - Scheduling collection removes/(re)creates/updates
10:08:43,708 DEBUG AbstractFlushingEventListener:85 - Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
10:08:43,718 DEBUG AbstractFlushingEventListener:91 - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
10:08:43,738 DEBUG Printer:83 - listing entities:
10:08:43,738 DEBUG Printer:90 - org.hibernate.test.cascade.Job{processingInstructions=Just do it!, status=0, batch=org.hibernate.test.cascade.JobBatch#1, id=2}
10:08:43,738 DEBUG Printer:90 - org.hibernate.test.cascade.JobBatch{batchDate=2005-10-26 10:08:42, jobs=[org.hibernate.test.cascade.Job#1, org.hibernate.test.cascade.Job#2], id=1}
10:08:43,768 DEBUG Printer:90 - org.hibernate.test.cascade.Job{processingInstructions=I know you can do it!, status=0, batch=org.hibernate.test.cascade.JobBatch#1, id=1}
10:08:43,768 DEBUG AbstractFlushingEventListener:289 - executing flush
10:08:43,778 DEBUG NonstrictReadWriteCache:104 - Invalidating: org.hibernate.test.cascade.JobBatch.jobs#1
10:08:43,788 DEBUG AbstractFlushingEventListener:316 - post flush


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:36 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hi,

prepared statement caching is done by the connection pool c3p0.
Here are my settings from hibernate.cfg.xml:

Code:
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property>
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">100</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.timeout">100</property>


The the hibernate reference doc for details.

Hope this helps.


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.