Re: [HACKERS] JPA + enum == Exception

Tom Dunstan <pgsql@tomd.cc>

From: Tom Dunstan <pgsql@tomd.cc>
To: Kris Jurka <books@ejurka.com>
Cc: "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.org>
Date: 2013-07-05T07:51:03Z
Lists: pgsql-hackers
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