-->
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.  [ 4 posts ] 
Author Message
 Post subject: How do I enable autocommit?
PostPosted: Wed Nov 03, 2004 4:57 pm 
Newbie

Joined: Thu Oct 21, 2004 6:07 pm
Posts: 5
I've been trying to find information on this, but its a little vague.
I am using the C3P0 connection pool.
I tried setting this property in hibernate.properties:
hibernate.c3p0.autoCommitOnClose=true
That didn't work.
Then I read that a c3p0.properties file is required.
So I created that as well and set this in it. It didn't get picked up.
autoCommitOnClose=true


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 03, 2004 7:06 pm 
C3P0 Developer
C3P0 Developer

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

in your c3p0.properties file, the parameter should be:

c3p0.autoCommitOnClose=true

note that setting this to true is different from the calling setAutoCommit( true ) on a Connection object. In a well written-application, autoCommitOnClose should be unimportant, because transactional clients should explicitly call commit() or rollback() prior to closing their Connections.

What c3p0's autoCommitOnClose parameters means is this: if a Connection is closed with transactional work that has been neither commited or rolledback, what should happen to that work? By default, c3p0 rolls back uncommitted work on close. If you set c3p0's autoCommitOnClose to true, that unresolved transactional work will be silently committed.

smiles,
steve (c3p0 maintainer)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 03, 2004 8:02 pm 
Newbie

Joined: Thu Oct 21, 2004 6:07 pm
Posts: 5
Thanks Steve,
In my case I read that MySQL does not enable query caching if auto commit is disabled. That's why I was trying to enable it. (My data doesn't change, so autocommit either way would be okay for me).
How do we set connection.setAutoCommit (true) through hibernate?
Thanks again


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 03, 2004 8:07 pm 
Newbie

Joined: Thu Oct 21, 2004 6:07 pm
Posts: 5
I'm guesing session.connection().setAutoCommit(true) will work. I'll try it out.
Thanks!
BTW, is C3P0 now considered production quality. I've seen conflicting comments about it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.