Re: [HACKERS] JPA + enum == Exception

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [HACKERS] JPA + enum == Exception
Date: 2013-07-05 07:51:03
Message-ID: CAPPfruw2cBztp+k6NTFVGHQL2JweoVYY8JTBoXHEVFMsQKT_Lg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 9 February 2013 02:56, Kris Jurka <books(at)ejurka(dot)com> wrote:

> The other workaround is to use the url parameter stringtype=unspecified to
> have setString always bind to unknown instead of varchar, which then
> shouldn't require any code changes.

I just tried this with a new project using hibernate and postgres with an
enum type . Unfortunately, the hibernate (3.6) enum type calls
setObject(pos, value, Types.VARCHAR) rather than calling setString(pos,
value), and that doesn't respect the stringtype property.

What's the feeling here - should setObject(Types.VARCHAR) respect
stringtype=unspecified? I don't know whether there are semantic differences
between setString() and setObject(Types.VARCHAR) to know if that's naughty
or not. It seems like the only way for me to use this version of hibernate
with pgsql enums is to either change the driver or implement a custom user
type and configure it everywhere. :(

Happy to whip up a patch if there's consensus to change the driver.

Cheers

Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2013-07-05 07:51:51 Re: Block write statistics WIP
Previous Message KONDO Mitsumasa 2013-07-05 07:50:50 Re: Improvement of checkpoint IO scheduler for stable transaction responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andreas Joseph Krogh 2013-07-05 09:21:17 Re: [HACKERS] JPA + enum == Exception
Previous Message dmp 2013-07-03 15:55:37 Re: Project plans