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 8790871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:45:46+00:00 2026-06-13T22:45:46+00:00

I am using JPA and data nucleus, in order to access a postgresql database.

  • 0

I am using JPA and data nucleus, in order to access a postgresql database.
My setup is as follows :

persistence.xml

<persistence-unit name="postgresql" >
    <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
    <class>com.something.DbClass1</class>
    <class>com.something.DbClass2</class>
    <exclude-unlisted-classes/>
    <properties>
        <property name="datanucleus.ConnectionDriverName" value="org.postgresql.Driver"/>
        <property name="datanucleus.ConnectionURL" value="jdbc:postgresql://IP:5432/some_db"/>
        <property name="datanucleus.ConnectionUserName" value="username"/>
        <property name="datanucleus.ConnectionPassword" value="password"/>
        <property name="datanucleus.connectionPoolingType" value="C3P0"/>
    </properties>
</persistence-unit>

I have also defined the C3P0.properties file :

c3p0.minPoolSize=15
c3p0.maxPoolSize=100
c3p0.initialPoolSize=15

I am using EntityManager like this :

EntityManager em = entityManager();
DbClass1 x = em.merge(input);
em.close();

Now, I have some oddities in the debug log. Connections seem to get opened/closed with each query (please see below):
Is anybody able to point out what I’m doing wrong here ? Thanks !

13:13:43,969 DEBUG [DataNucleus.Persistence] - Adding support for Java type boolean (persistent=true, DFG=true, embedded=true)
13:13:43,970 DEBUG [DataNucleus.Persistence] - Adding support for Java type byte (persistent=true, DFG=true, embedded=true)
13:13:43,970 DEBUG [DataNucleus.Persistence] - Adding support for Java type char (persistent=true, DFG=true, embedded=true)
...
13:13:44,738 INFO  [com.mchange.v2.c3p0.C3P0Registry] - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
13:13:44,766 DEBUG [com.mchange.v2.c3p0.management.DynamicPooledDataSourceManagerMBean] - MBean: com.mchange.v2.c3p0:type=PooledDataSource[1br5qth8q1lseuas1a25ohv|38d0357a] registered.
13:13:44,781 DEBUG [DataNucleus.Connection] - Created tx data source using pooling type of C3P0
13:13:44,781 DEBUG [DataNucleus.Connection] - Registered transactional connection factory under name "rdbms/tx"
13:13:44,796 DEBUG [com.mchange.v2.c3p0.management.DynamicPooledDataSourceManagerMBean] - MBean: com.mchange.v2.c3p0:type=PooledDataSource[1br5qth8q1lseuas1a25ohv|2415a94f] registered.
13:13:44,796 DEBUG [DataNucleus.Connection] - Created nontx data source using pooling type of C3P0
13:13:44,796 DEBUG [DataNucleus.Connection] - Registered nontransactional connection factory under name "rdbms/nontx"
13:13:44,915 INFO  [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1br5qth8q1lseuas1a25ohv|2415a94f, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.postgresql.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1br5qth8q1lseuas1a25ohv|2415a94f, idleConnectionTestPeriod -> 0, initialPoolSize -> 15, jdbcUrl -> jdbc:postgresql://IP:5432/some_db, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 3600, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 15, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
13:13:45,201 DEBUG [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@2a801059.acquireResource() returning. 
13:13:45,203 DEBUG [DataNucleus.Connection] - Connection "com.mchange.v2.c3p0.impl.NewProxyConnection@695cd9c0" opened
13:13:45,205 DEBUG [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@2a801059.acquireResource() returning. 
13:13:45,205 DEBUG [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@2a801059.acquireResource() returning. 
13:13:45,308 DEBUG [DataNucleus.Datastore] - Adding RDBMS support for Java type java.lang.Boolean (jdbc-type=BIT, sql-type=BIT, datastore-mapping-type=org.datanucleus.store.rdbms.mapping.BitRDBMSMapping, default=true)
13:13:45,309 DEBUG [DataNucleus.Datastore] - Adding RDBMS support for Java type java.lang.Boolean (jdbc-type=CHAR, sql-type=CHAR, datastore-mapping-type=org.datanucleus.store.rdbms.mapping.CharRDBMSMapping, default=false)
13:13:45,310 DEBUG [DataNucleus.Datastore] - Adding RDBMS support for Java type java.lang.Boolean (jdbc-type=BOOLEAN, sql-type=BOOLEAN, datastore-mapping-type=org.datanucleus.store.rdbms.mapping.BooleanRDBMSMapping, default=false)
13:13:45,311 DEBUG [DataNucleus.Datastore] - Adding RDBMS support for Java type java.lang.Boolean (jdbc-type=SMALLINT, sql-type=SMALLINT, datastore-mapping-type=org.datanucleus.store.rdbms.mapping.SmallIntRDBMSMapping, default=false)
...
13:14:11,791 DEBUG [DataNucleus.Persistence] - Object "<redacted>@52c51614" being inserted into table "<redacted>""
13:14:11,791 DEBUG [DataNucleus.Connection] - Connection added to the pool : [org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl@1b78efd8, null] for key=org.datanucleus.ObjectManagerImpl@699c9f16 in factory=ConnectionFactory:nontx[org.datanucleus.store.rdbms.ConnectionFactoryImpl@29422384]
13:14:11,791 DEBUG [DataNucleus.Connection] - Setting autocommit=false to connection: com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a
13:14:11,842 DEBUG [DataNucleus.Connection] - Connection "com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a" opened with isolation level "read-committed"
13:14:11,843 DEBUG [DataNucleus.Datastore.Persist] - Retrieving PreparedStatement for connection "com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a"
13:14:11,843 DEBUG [DataNucleus.Datastore.Native] - INSERT INTO <redacted> ...
13:14:11,843 DEBUG [DataNucleus.Datastore.Native] - INSERT INTO <redacted> ...
13:14:11,897 DEBUG [DataNucleus.Datastore.Persist] - Execution Time = 53 ms (number of rows = 1)
13:14:11,897 DEBUG [DataNucleus.Persistence] - Insert of object "<redacted>" is calling insertPostProcessing for field "<redacted>"
13:14:11,897 DEBUG [DataNucleus.Datastore.Retrieve] - Closing PreparedStatement org.datanucleus.store.rdbms.ParamLoggingPreparedStatement@3970ae0
13:14:11,990 DEBUG [DataNucleus.Connection] - Connection "com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a" non enlisted to a transaction is being committed.
13:14:11,990 DEBUG [DataNucleus.Connection] - Connection "com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a" closed
13:14:11,990 DEBUG [DataNucleus.Connection] - Connection removed from the pool : [org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl@1b78efd8, com.mchange.v2.c3p0.impl.NewProxyConnection@455dd32a] for key=org.datanucleus.ObjectManagerImpl@699c9f16 in factory=ConnectionFactory:nontx[org.datanucleus.store.rdbms.ConnectionFactoryImpl@29422384]
  • 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-06-13T22:45:47+00:00Added an answer on June 13, 2026 at 10:45 pm

    You mean that you have a DataSource (for C3P0) and that DataNucleus gets a connection, and calls close on it when it doesn´t need it. And indeed this is exactly what you are supposed to do for a connection pool DataSource. And C3P0 controls when the real JDBC connection is actually closed. So no, DataNucleus is doing nothing wrong there as far as i can see (in the publically viewable code).

    You refer to some nontransactional code (so the connection will only be held for a single operation, unless you have a persistence property set to retain it, in the docs), and refer to a “query” yet I see no such query, just a “merge”.

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

Sidebar

Related Questions

I'm using Spring-Data-JPA 1.0.3.RELEASE to manage my ORM. my persistence.xml looks like this: <persistence>
I am using JPA namedQuery to select data from DB. @NamedQuery(name = Concept.findByRefTableNull, query
We're currently developing a J2EE web app using JPA as our data access layer.
I am using JPA to access an Oracle database which has its encoding set
I'm creating a Java EE application that's using JPA for data access. Initially I
I am investigating using JPA for my Data Access code. I am trying to
I'm using JPA for the data access layer of my application. I have a
JPA/Hibernate missing column I am using JPA with Hibernate as the provider. I had
I'm using JPA 2.0 and want to create a unique constraint using XML, not
I've switched from using Spring Data JPA for regular DAO objects with Entity Manager

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.