Re: 2.1 Spec: detached-dirty parameters to makePersistent() when DetachAllOnCommit=tru
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache JDO Project > Re: 2.1 Spec: detached-dirty parameters to makePersistent() when DetachAllOnCommit=tru




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: 2.1 Spec: detached-dirty parameters to makePersistent() when DetachAllOnCommit=tru  
Andy Jefferson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-08-07 12:11 AM

> With this restriction in place, however, would I be able to do the=20
> following?=20

> // fetch a detched object
> Query q =3D pm.newQuery(Foo.class);
> q.setUnique(true);
> Foo foo =3D (Foo) q.execute();

"detachAllOnCommit" will transition instances to detached *at commit*. You=
=20
have no commit here (using nontransactionalRead ?). If you have tx.begin(),=
=20
tx.commit() around it then its definitely fine. Nothing in the spec=20
definition of "detachAllOnCommit" implies (to me) that queries run with=20
non-tx read will do the detach.

> // make it dirty:
> foo.setBar("bar");

"foo" : detached-clean -> detached-dirty

> // attach
> pm.currentTransaction().begin();
> pm.makePersistent(foo);

"foo" : detached-dirty -> persistent-clean

> pm.currentTransaction().commit();

"foo" : persistent-clean -> detached-clean

> // dirty it once more
> foo.addBaz("baz");

"foo" : detached-clean -> detached-dirty

> // and attach it a second time

"foo" : detached-dirty -> persistence-clean

> - wouldn't this cause the  JDOUserException you mention above?=20

No. If referring to the same PM, the object would have been removed from L1=
=20
cache at detach. The exception I was referring to was if you did a separate=
=20
PM.detachCopy() or detached it from a different PM and *then* tried to atta=
ch=20
to the same PM as one that already had it.




=2D-=20
Andy =A0(Java Persistent Objects - http://www.jpox.org)






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:49 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register