0

I have a question related to hibernate connention managing/pooling.

If I write sessionFactory.openSession(), will hibernate create a fresh, new JDBC connection?

My C3PO properties look like this:

    <property name="hibernate.c3p0.acquire_increment">1</property>
    <property name="hibernate.c3p0.min_size">0</property>
    <property name="hibernate.c3p0.max_size">10</property>

2 Answers 2

2

If you got c3p0 configured properly, you will get a pooled connection (not a fresh one).

Sign up to request clarification or add additional context in comments.

Comments

1

It will check the pool and if there is any open non-locked connection, then it will use that one. If all the connections in the pool are currently used or there is no connection, then it will open 1. If the connection pool contains 10 locked connection then it will give an exception

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.