openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gav <>
Subject OpenJPA MySQL Environment: NamedQuery always returns null for @Enumerated column types
Date Wed, 28 Nov 2007 09:29:21 GMT

Hello, i have a WebsphereCE application environment (OpenEJB/OpenJPA
1.0.0/MySQL 5.0.27 with JDBC driver 3.1.14).
When running a NamedQuery on the Entity Bean i find the returned object is
fully populated as expected EXCEPT for the Enum(erated) type which always
came back null (in error).

@Table( name = "Client" )
@NamedQueries( {
        @NamedQuery( name = "Client.getClientCasenoteDataByEmpiId", query =
"select c from Client c JOIN FETCH c.assets where c.epmiId = :epmiId" ),
public class Client implements Serializable {
    @Column( name = "Gender" )
    @Enumerated( EnumType.STRING )
    private Gender            gender           = Gender.UNSPECIFIED;

// This gender field in the Client object graph always comes back null
despite the database having a column definition consistent with storing the
enum values as strings in database.

Gender varchar(255) NULL     (a column definition confirmed by
autogeneration by openjpa using synchronizemappings property)...

Enum class is

public enum Gender {


For the record also tried the default ordinal approach, also the MySQL
3.1.12,3.1.14 and 5.0.4 JDBC Drivers but always get nothing back but null.
Has anyone seen this problem or could point me in the right direction ???
thanks for your help !

View this message in context:
Sent from the OpenJPA Developers mailing list archive at

View raw message