I'd suggest using DBCP for connection pooling when not running in a JEE environment. Checkout this blog post [1] that I wrote about this very issue a few months back.
-Rick [1] http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html On Mon, Sep 28, 2009 at 3:53 AM, Jean-Baptiste BRIAUD -- Novlog < [email protected]> wrote: > OK, so is there a way to have add pool behavior with only JDBC (without > J2EE) ? > > > > On Sep 28, 2009, at 05:04 , C N Davies wrote: > > The doc says: >> >> "EntityManagerFactory instances are heavyweight objects. Each factory >> might >> maintain a metadata cache, object state >> cache, EntityManager pool, connection pool, and more." >> >> "2.6.3. openjpa.jdbc.DriverDataSource >> Property name: openjpa.jdbc.DriverDataSource >> Configuration API: >> org.apache.openjpa.jdbc.conf.JDBCConfiguration.getDriverDataSource >> Resource adaptor config-property: DriverDataSource >> Default: pooling" >> >> "In its default configuration, OpenJPA obtains JDBC connections on an >> as-needed basis. OpenJPA EntityManagers do not retain >> a connection to the database unless they are in a datastore transaction or >> there are open Query results that are using a live >> JDBC result set. At all other times, including during optimistic >> transactions, EntityManagers request a connection for each >> query, then immediately release the connection back to the pool." >> >> >> -----Original Message----- >> From: Christopher Giblin [mailto:[email protected]] >> Sent: Monday, 28 September 2009 1:11 AM >> To: [email protected] >> Subject: relationship EntityManager and JDBC Connection? >> >> >> Hi, >> >> Does an EntityManager instance correspond one-to-one to a JDBC connection? >> When the EM is closed, is the JDBC connection closed? That is, by opening >> and closing EMs, is one also opening and closing JDBC connections? >> >> I am using OpenJPA with Derby. There is no connection pooling: >> >> <property name="openjpa.ConnectionDriverName" value= >> "org.apache.derby.jdbc.ClientDriver"/> >> >> Sorry if I overlooked in the excellent documentation. >> >> Thanks,chris >> >> >> >
