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:[EMAIL PROTECTED] > Sent: Monday, December 17, 2007 12:34 PM > To: [email protected] > 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 [EMAIL PROTECTED] 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.
