Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 216F7633D5B for ; Tue, 26 May 2009 12:17:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 79867-06 for ; Tue, 26 May 2009 12:17:37 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f167.google.com (mail-ew0-f167.google.com [209.85.219.167]) by mail.postgresql.org (Postfix) with ESMTP id 26535633C5D for ; Tue, 26 May 2009 12:17:36 -0300 (ADT) Received: by ewy11 with SMTP id 11so3937210ewy.19 for ; Tue, 26 May 2009 08:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=2Tzd6TvKEtLI8M/k+SgwNoN9/YnD/w7TUuvcQIwNCbU=; b=pajWArkUJ8BvTZ6I7bB76dVCb8fFusWVD0VfHx/8OzBq0h8WKr/EbV8g4uYAa8C9Ic KSbrCBI/0suHfYRKAjgEzGDFs6GYXGZi+slFuLeod5UJVnZnc2kFBMH/eQUJzAVeJsR/ ZHc9ZC3QlFPe6nRpNxF6cEYiIvVo+jXbqxt3g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=LEqPKyk+uOjSONGByVD5qeO+kAzToAWVJItI+Ug3BqjX15NooVjnyow4X/oL5h6vcq CFu9+vzsYzmxs/bU7yCfFePCtj5qLXkCuUBTsLw4HQI3ccy5t5Ofi7ePplrsJUtbb/of 7qN0J0QbqSFoEL2R4NwU6ZGTioIgpxHNm92Rw= MIME-Version: 1.0 Received: by 10.216.46.83 with SMTP id q61mr3301295web.71.1243351055831; Tue, 26 May 2009 08:17:35 -0700 (PDT) In-Reply-To: <23705886.post@talk.nabble.com> References: <548aeab30905230702x1e7d0620nb3686c49bf889a68@mail.gmail.com> <4A18E936.1030803@postnewspapers.com.au> <23705886.post@talk.nabble.com> Date: Tue, 26 May 2009 17:17:35 +0200 Message-ID: <321ed0a30905260817s5f92344kc7ecb76af623f3b3@mail.gmail.com> Subject: Re: Java persistence with enum types From: The Jasper To: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/103 X-Sequence-Number: 19653 On Mon, May 25, 2009 at 2:01 PM, Susannah 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/