Re: Java persistence with enum types

From: The Jasper <thejasper(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Java persistence with enum types
Date: 2009-05-26 15:17:35
Message-ID: 321ed0a30905260817s5f92344kc7ecb76af623f3b3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, May 25, 2009 at 2:01 PM, Susannah <cyclingrelf(at)googlemail(dot)com> wrote:
>
> Hi,
>
> Thanks for trying to help Craig, but I had tried the @enumerated annotation
> already with the same error message. The @enumerated annotation doesn't
> return an enum type to Postgres, but instead returns the ordinal value (by
> default) or a string value of the enum. This means I get either the error
> message:
>
> Caused by: org.postgresql.util.PSQLException: ERROR: column "typeofname" is
> of type typeofnames but expression is of type character varying
> (if I use enumtype STRING)
>
> Or
>
> Caused by: org.postgresql.util.PSQLException: ERROR: column "typeofname" is
> of type typeofnames but expression is of integer

I think you have the same problem I did a while back. A colleague of
mine figured it out. There is a partial answer here:
http://stackoverflow.com/questions/851758/java-enums-jpa-and-postgres-enums-how-do-i-make-them-work-together

Don't have time to dig up and clean up the actual code we use now but
I can if you'd like (and you're not in a hurry).

mvg,

Jasper
--
http://xkcd.com/583/

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jesper Pedersen 2009-05-26 16:56:48 JDBC on the Wiki
Previous Message Bojan Skaljac 2009-05-26 09:54:25 Implementation of get/set functions with string parameters