From: Craig Ringer <craig@postnewspapers.com.au>
To: Steve Waldman <swaldman@mchange.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: Vaibhav Patil <infovaibhav@yahoo.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: COPY using Hibernate
Date: Sat, 16 Jan 2010 00:21:09 +0800
Message-ID: <4B5095F5.20508@postnewspapers.com.au> (raw)
In-Reply-To: <82F2099D-4E4C-4073-A900-56A08DDEFD34@mchange.com>
References: <170472.26453.qm@web94901.mail.in2.yahoo.com>
<491f66a51001150400sf2c6b04l840af9f01c3e55bb@mail.gmail.com>
<4B5066B1.6050709@postnewspapers.com.au>
<82F2099D-4E4C-4073-A900-56A08DDEFD34@mchange.com>
Steve Waldman wrote:
> you can just check out the inner Connection with c3p0's reflective API,
> if you want. the preachiness is a speedbump, but nothing prevents you
> from returning RAW_CONNECTION_OBJECT. just be sure that when you're
> done, the you've not left the state of the Connection modified, cuz that
> can lead to subtle misbehavior.
With Hibernate's Session object, sure - you can getConnection() from the
session, then reflectively access the methods of the underlying
PGConnection via C3P0. It's ugly but works.
I was about to say that you can't get the Connection object from
EntityManager if using Hibernate, when I realised you can call
EntityManager.getDelegate() to get the Session, then getConnection() on
that. I have no idea how I missed getDelegate() before.
Sigh. Guess you *can* just use C3P0's reflective calls even if using JPA.
--
Craig Ringer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: craig@postnewspapers.com.au, swaldman@mchange.com, pg@fastcrypt.com, infovaibhav@yahoo.com
Subject: Re: COPY using Hibernate
In-Reply-To: <4B5095F5.20508@postnewspapers.com.au>
References: <170472.26453.qm@web94901.mail.in2.yahoo.com> <491f66a51001150400sf2c6b04l840af9f01c3e55bb@mail.gmail.com> <4B5066B1.6050709@postnewspapers.com.au> <82F2099D-4E4C-4073-A900-56A08DDEFD34@mchange.com> <4B5095F5.20508@postnewspapers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox