Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 52FF8633211 for ; Mon, 25 May 2009 09:01:35 -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 10058-08 for ; Mon, 25 May 2009 09:01:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by mail.postgresql.org (Postfix) with ESMTP id B4F2D632323 for ; Mon, 25 May 2009 09:01:32 -0300 (ADT) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1M8Yry-0008NU-CK for pgsql-jdbc@postgresql.org; Mon, 25 May 2009 05:01:30 -0700 Message-ID: <23705886.post@talk.nabble.com> Date: Mon, 25 May 2009 05:01:30 -0700 (PDT) From: Susannah To: pgsql-jdbc@postgresql.org Subject: Re: Java persistence with enum types In-Reply-To: <4A18E936.1030803@postnewspapers.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: cyclingrelf@googlemail.com References: <548aeab30905230702x1e7d0620nb3686c49bf889a68@mail.gmail.com> <4A18E936.1030803@postnewspapers.com.au> 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/97 X-Sequence-Number: 19647 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 Craig Ringer wrote: > > Susannah Relf wrote: >> Hi, I have an enum type in my postgres 8.3 database: >> >> CREATE TYPE typeOfNames AS ENUM ('Latin', 'Common', 'Local'); >> >> I am trying to access the database through the Java Persistence API using >> Netbeans: >> @Lob >> @Column(name = "typeofname") >> private String typeofname; > > One minute with Google: > > @Enumerated > http://java.sun.com/javaee/5/docs/api/javax/persistence/Enumerated.html > > http://forums.java.net/jive/thread.jspa?messageID=240608 > http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Enumerated > ... etc ... > > -- > Craig Ringer > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc > > -- View this message in context: http://www.nabble.com/Java-persistence-with-enum-types-tp23684815p23705886.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.