openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: provide an actual JDBC connection?
Date Thu, 26 Apr 2007 16:07:01 GMT

On Apr 26, 2007, at 2:10 AM, tbee wrote:

>
> Is it possible to provide an actual JDBC connection instead of connect
> parameters?

You can supply the datasource instance in a PersistenceUnitInfo, but  
I certainly hope you can't provide a connection.
>
> The business model I'm trying to construct will work inside an  
> existing
> application which does direct JDBC. There is already a connection  
> open and
> it would be a waste of resource to have two. I can always hack  
> together a
> special Driver for this. Another solution would be to use the  
> connection of
> OpenJPA.

Are you running inside a javaee app server?  (not standalone tomcat)  
If so there's a very good chance that all the connection handles  
obtained within the same jta transaction actually use the same  
physical connection to the database.  Geronimo certainly does this.
>
> One concern: how many actual JDBC connections are opened during a  
> run. I
> assume that only one is opened and that the JPA "transaction"  
> concept is not
> directly related to the JDBC transactions. That JDBC transactions  
> are only
> used during a JPA transaction's commit phase.

If you use table based "sequences" and supply a non-jta-datasource as  
well as a jta datasource, typically 2 connections will be used.   
However, if you are in an environment that does connection pooling  
this won't make much difference.

Hope this helps
david jencks


> -- 
> View this message in context: http://www.nabble.com/provide-an- 
> actual-JDBC-connection--tf3650466.html#a10196861
> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>


Mime
View raw message