Re: COPY using Hibernate

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Steve Waldman <swaldman(at)mchange(dot)com>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, Vaibhav Patil <infovaibhav(at)yahoo(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: COPY using Hibernate
Date: 2010-01-15 16:21:09
Message-ID: 4B5095F5.20508@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2010-01-15 16:31:39 Re: COPY using Hibernate
Previous Message Vaibhav Patil 2010-01-15 14:49:53 Re: COPY using Hibernate