Re: [HACKERS] JPA + enum == Exception - Mailing list pgsql-jdbc

From Tom Dunstan
Subject Re: [HACKERS] JPA + enum == Exception
Date
Msg-id CAPPfruw2cBztp+k6NTFVGHQL2JweoVYY8JTBoXHEVFMsQKT_Lg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] JPA + enum == Exception  (Kris Jurka <books@ejurka.com>)
Responses Re: [HACKERS] JPA + enum == Exception  (Andreas Joseph Krogh <andreak@officenet.no>)
List pgsql-jdbc
On 9 February 2013 02:56, Kris Jurka <books@ejurka.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

pgsql-jdbc by date:

Previous
From: dmp
Date:
Subject: Re: Project plans
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: [HACKERS] JPA + enum == Exception