Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:50:12+00:00 2026-05-30T15:50:12+00:00

I am using hibernate and c3p0 for the database, and i have an java

  • 0

I am using hibernate and c3p0 for the database, and i have an java application, with ThreadPoolExecutor.
What i am doing is, I am enquing different Tasks each related to hibernate, to store data with Hibernate using Transactions, and getCurrentSession.
So I have

new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.MINUTES,taskQueue);

Runnable
{
 @Override
 public void run() {
    Session session = HibernateDAO.getInstance().getCurrentSession();
    Transaction tx = null;  
    try
{tx = session.beginTransaction(); .....
}     

And hibernate.cfg
thread
org.hibernate.connection.C3P0ConnectionProvider
1

        <!-- Database c3p0 settings -->
        <property name="hibernate.c3p0.min_size">3</property>
        <property name="hibernate.c3p0.max_size">3</property>
        <property name="hibernate.c3p0.initialPoolSize">3</property>
        <property name="hibernate.c3p0.max_statements">100</property>
        <property name="hibernate.c3p0.timeout">5000</property>
        <property name="hibernate.c3p0.acquire_increment">2</property>

My goal is to get per thread from the executor, to get a connection using getCurrentSession, and execute session.saveOrUpdate(item),
Now I have couple of questions.
Which Isolation level should i use, because i have 95% writes/updates and 5% reads, and reads are not interupted by the writes.
I get in the HTML log from log4j

905     pool-1-thread-1     DEBUG   com.mchange.v2.resourcepool.BasicResourcePool   trace com.mchange.v2.resourcepool.BasicResourcePool@434cb775 [managed: 3, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@697506e6)
905     pool-1-thread-5     DEBUG   com.mchange.v2.resourcepool.BasicResourcePool   trace com.mchange.v2.resourcepool.BasicResourcePool@434cb775 [managed: 3, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@697506e6)
965     pool-1-thread-4     DEBUG   com.mchange.v2.resourcepool.BasicResourcePool   trace com.mchange.v2.resourcepool.BasicResourcePool@434cb775 [managed: 3, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@697506e6)

Does this mean That i have only 1 Connection in c3p0, or multiple connections in one pool?

AM I USING IT AS IT SHOULD BE USED????

what level of isolation will be best for concurrent writes?

thanks in advance to all, if anyone needs more data and explanation just poke.

–EDIT: answered

As suggested from the answerd, I have checked the mysql server admin, and there are more connections which are used for quering.. so IT IS THE RIGHT WAY to use it :D…
As for the isolation levels ill try to let

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:50:15+00:00Added an answer on May 30, 2026 at 3:50 pm

    This means you have one pool with 3 initial connections. You should be able to confirm this looking at your SQL server monitor.

    Remember that your SQL server config trumps C3PO’s, so if you have multiple threads competing for transactions on the same table you could find your write/update operations blocked regardless of your pool configuration.

    You might find batching your insert/updates within a single transaction might provide a better performance boost than moving them to separate threads. This article an interesting read.

    As for specifying a level of isolation, my understanding is that this is more a question of read performance than for writes. I’ve never found myself in a situation where I would want anything less than READ COMMITTED, since allowing dirty reads with READ UNCOMMITTED completely obliterates the advantages of using an ACID database in the first place. However I’m not an expert in this field, someone else might have a different opinion. If this really is a concern for you, I would benchmark both settings against the database of your choice to determine how much performance can be gained, if any.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Hibernate in a Java application to access my Database and it
I have an application that is using Hibernate 3, c3p0, and spring 2.5.6. We
I am using Hibernate in an Eclipse RAP application. I have database tables mapped
I'm using Hibernate for ORM of my Java app to an Oracle database (not
I'm using Hibernate with Spring in my application. I have been consistently using detached
I build j2ee application using spring, hibernage-JPA and c3p0 for connection pool. I have
I have been using Hibernate + HSQLDB on my desktop for developing a database
So I'm using hibernate and working with an application that manages time. What is
we are running java6/hibernate/c3p0/postgresql stack. Our JDBC Driver is 8.4-701.jdbc3 I have a few
I'm using hibernate 3 with c3p0 for a program which constantly extracts data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.