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

From Hudson, Derrick
Subject Re: JPA + enum == Exception
Date
Msg-id 401084E5E73F4241A44F3C9E6FD794289CE24D03@exch-01
Whole thread Raw
In response to JPA + enum == Exception  ("Marc G. Fournier" <scrappy@hub.org>)
Responses Re: JPA + enum == Exception
List pgsql-jdbc
The project I am working on uses enums in PostgreSQL and JPA/Eclipselink.  Our entities use enums in the Java code as
well. We ran into type handling issues like you describe, and solved them by writing converters.  Eclipselink needs to
betold how to convert between the PGobject instance used by the JDBC driver and the Java enum value (or String, if
that'swhat you are using in the Java code). 

http://www.eclipse.org/eclipselink/api/2.4/org/eclipse/persistence/mappings/converters/Converter.html

http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_converter.htm



-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Marc G. Fournier
Sent: Monday, December 17, 2012 6:02 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] JPA + enum == Exception


I'm trying to use enum's in a database, but the java guys are telling me that they are having problems with inserts ...
readingfrom the database isn't a problem, but there appears to be an issue with converting from string -> enum when
savingit back again ... 

they are using JPA2 / EJB + Eclipselink ... on the jboss side, we are running the latest jdbc driver ...

considering postgresql has always supported enum and extending types, I think they might be missing something, but I
can'tthink of what to suggest ... 

Is there a doc online I can maybe point them to about doing this ... ?



pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Re: performance problem of Failover Datasource?
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception