openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ajay Aggarwal" <aaggar...@covergence.com>
Subject RE: @Enumerated (EnumType.STRING) - select query returns NULL values
Date Mon, 17 Dec 2007 18:32:51 GMT
Thanks. Good to know that its been fixed in newer versions of OpenJPA.

-----Original Message-----
From: Tedman Leung [mailto:tedman@sfu.ca] 
Sent: Monday, December 17, 2007 1:16 PM
To: users@openjpa.apache.org
Subject: Re: @Enumerated (EnumType.STRING) - select query returns NULL
values

you could try a newer version of openJpa, I used the 1.0 and currently
the 
1.1 snapshot versions and I haven't had those problems and I've done the

exact same thing, enumeration to string.

> Found the answer in other threads. Looks like by default LAZY fetching
> is used for @Enumerated (I don't agree here though). 
> 
> If I use fetchType EAGER on this field, it works fine...
> 
>     @Basic( fetch = FetchType.EAGER )
>     @Enumerated(EnumType.STRING)
>     ActionType action;
> 
> -Ajay
> -----Original Message-----
> From: Ajay Aggarwal [mailto:aaggarwal@covergence.com] 
> Sent: Monday, December 17, 2007 12:34 PM
> To: users@openjpa.apache.org
> Subject: @Enumerated (EnumType.STRING) - select query returns NULL
> values
> 
> One of my fields is of enumeration type 'ActionType'. I persist it as
> STRING value:
> 
> @Entity
> @Table(name = "dialplan")
> public class DialPlan {
>     ...
>     @Enumerated(EnumType.STRING)
>     ActionType action;
> 
> }
> 
> When I read back the table using simple JPQL "Select X from DialPlan
X",
> everything else is read correctly but the value of this field is NULL
> for all rows. 
> 
> While persisting new entries, the field gets written to the database
> correctly. Even queries like below select correct rows:
>     Query q = em.createQuery(
>         "SELECT x FROM DialPlan x where x.action = :action");
>     q.setParameter("action", action);
> 
> I haven't tried persisting as ORDINAL values.
> 
> Is it a bug? Has anybody else faced this?
> 
> My environment is openjap 0.97 in WebLogic 10.
> 
> -Ajay
> 

-- 
                                                           Ted Leung
                                                           tedman@sfu.ca

Just because some one has to live or deal with something doesn't mean
it's
alright or it's okay. Don't ever tell them that it's alright or it's
okay 
because it's not, and they know it.

Mime
View raw message