openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: How to get I get to the read JDBC Connection object...
Date Tue, 01 Apr 2008 03:31:51 GMT

Hi,
   Following should work:

import javax.persistence.EntityManager;
import org.apache.openjpa.kernel.Broker;
import org.apache.openjpa.jdbc.kernel.JDBCStore;
import org.apache.openjpa.persistence.JPAFacadeHelper;
import java.sql.Connection;
  
        EntityManager em = emf.createEntityManager();
        Broker broker = JPAFacadeHelper.toBroker(em);

        JDBCStore store = (JDBCStore)broker.getStoreManager();
        Connection con = store.getConnection();




David Goodenough-3 wrote:
> 
> I need to get to the real JDBC Connection object so that I can do some
> processing using Postgresql extensions (in particular the LargeObject
> support).  I do not expect OpenJPA to understand what I am doing, but
> I need to access the Connection object and I need what I do to be 
> in the same transaction as that used by OpenJPA (so also it needs to
> be the same transaction).
> 
> The manual suggests:-
> 
> OpenJPAEntityManagerFactory kemf = OpenJPAPersistence.cast(emf);
> OpenJPAConfiguration conf = kemf.getConfiguration();
> 
> on page 190, but kemf does not have a getConfiguration method according
> to Eclipse (using OpenJPA 1.0.2).
> 
> The OpenJPAConfiguration javadoc is not much use either in that it does
> tell me where to get it from.
> 
> Any ideas?
> 
> David
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-I-get-to-the-read-JDBC-Connection-object...-tp16400383p16401689.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message