openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plins...@gmail.com
Subject Re: Hooray - this works ! - Re: OpenJPA MySQL Environment: NamedQuery always returns null for @Enumerated column types
Date Thu, 29 Nov 2007 02:17:37 GMT
Great. FTR I agree that it should be eager by default. I thought we
fixed this recently.

-Patrick

On 11/28/07, gav <gavin_bayfield@hotmail.com> wrote:
>
> Dah ! thankyou ...the following works
> (for the record i assumed Eager loading was  default for Enum since
> one-to-one mapping?!)
>
>     @Column( name = "Gender" )
>     @Basic( fetch = FetchType.EAGER )
>     @Enumerated( EnumType.STRING )
>     private Gender            gender           = Gender.UNSPECIFIED;
>
> -----------------------
>
>
>
>
>
> Patrick Linskey-2 wrote:
> >
> > Hi,
> >
> > Are you using the OpenJPA enhancer? What happens if you explicitly set
> > the fetch mode to eager in the @Enumerated annotation?
> >
> > -Patrick
> >
> > On 11/28/07, gav <gavin_bayfield@hotmail.com> wrote:
> >>
> >> 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).
> >>
> >> @Entity
> >> @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 {
> >>
> >>     MALE, FEMALE, UNSPECIFIED;
> >>
> >>
> >> 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:
> >>
> http://www.nabble.com/OpenJPA-MySQL-Environment%3A-NamedQuery-always-returns-null-for-%40Enumerated-column-types-tf4887323.html#a13988839
> >> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Patrick Linskey
> > 202 669 5907
> >
> >
> :-D:-D
> --
> View this message in context:
> http://www.nabble.com/OpenJPA-MySQL-Environment%3A-NamedQuery-always-returns-null-for-%40Enumerated-column-types-tf4887323.html#a13995534
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message