Re: COPY using Hibernate - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: COPY using Hibernate
Date
Msg-id 4B5095F5.20508@postnewspapers.com.au
Whole thread Raw
In response to Re: COPY using Hibernate  (Steve Waldman <swaldman@mchange.com>)
List 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

pgsql-jdbc by date:

Previous
From: Vaibhav Patil
Date:
Subject: Re: COPY using Hibernate
Next
From: Craig Ringer
Date:
Subject: Re: COPY using Hibernate