openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Elin" <eli...@gmail.com>
Subject Re: EntityManager.find problem
Date Fri, 14 Sep 2007 10:38:10 GMT
May be user detached?

try to insert entityManager.merge(user)

before commt

2007/9/14, Gurkan Erdogdu <gurkanerdogdu@yahoo.com>:
>
> Yeap. I began transaction. The message is that
>
> --> The object User with oid='12345678934324234blabla' is not in the
> persistent context.
>
> Thanks
>
>
>
> ----- Original Message ----
> From: Gene Wu <gene_wu@hotmail.com>
> To: users@openjpa.apache.org
> Sent: Friday, September 14, 2007 11:07:26 AM
> Subject: RE: EntityManager.find problem
>
>
> could you try to begin the transaction before you find the object?
>
> and what's your error message?
>
> Thanks,
>
> Gene
>
>
> > Date: Fri, 14 Sep 2007 00:23:03 -0700
> > From: gurkanerdogdu@yahoo.com
> > Subject: Re: EntityManager.find problem
> > To: users@openjpa.apache.org
> >
> > Hey,
> >
> > You could just get a some reference using find() method and try commit
> transaction on it.
> >
> > It must not be so complicated :)
> >
> > Thanks;
> >
> >
> >
> > ----- Original Message ----
> > From: Patrick Linskey <plinskey@gmail.com>
> > To: users@openjpa.apache.org
> > Sent: Friday, September 14, 2007 4:21:49 AM
> > Subject: Re: EntityManager.find problem
> >
> >
> > Hi,
> >
> > Is there any way you could post a unit test that demonstrates the
> problem?
> >
> > -Patrick
> >
> > On 9/13/07, Gurkan Erdogdu <gurkanerdogdu@yahoo.com> wrote:
> > > Hi I am using 0.9.7 version. My problem is that;
> > >
> > > I got managed object User. I want to update status of user. The below
> code does noting when commit transaction;
> > >
> > > EntityManager manager = get entitymanager
> > > EntityTransaction transaction = manager.getTransaction();
> > >
> > > User user = manager.find(User.class,useroid);
> > > user.setstatus('s');
> > >
> > > transaction.commit;
> > >
> > > manager.close;
> > >
> > > But when I changes the code to get user object with query, then it
> works when commit transaction and update database
> > >
> > >
> > > EntityManager manager = get entitymanager
> > >
> > > EntityTransaction transaction = manager.getTransaction();
> > >
> > >
> > > Query q = manager.createQuery('select c User c where c.oid=:oid');
> > > User user = q.getResultList().get(0);
> > >
> > >
> > > user.setstatus('s');
> > >
> > > transaction.commit;
> > >
> > >
> > >
> > > manager.close;
> > >
> > > What is the problem with manager.find()?
> > >
> > > Thanks;
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> ____________________________________________________________________________________
> > > Pinpoint customers who are looking for what you sell.
> > > http://searchmarketing.yahoo.com/
> > >
> >
> >
> > --
> > Patrick Linskey
> > 202 669 5907
> >
> >
> >
> ____________________________________________________________________________________
> > Check out the hottest 2008 models today at Yahoo! Autos.
> > http://autos.yahoo.com/new_cars.html
>
> _________________________________________________________________
> Kick back and relax with hot games and cool activities at the Messenger
> Café.
> http://www.cafemessenger.com?ocid=TXT_TAGLM_SeptWLtagline
>
>
>
>
> ____________________________________________________________________________________
> Building a website is a piece of cake. Yahoo! Small Business gives you all
> the tools to get online.
> http://smallbusiness.yahoo.com/webhosting
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message