> 
> Betreff:      semantics of deleted objects
> Datum:        Wed, 2 Sep 2015 10:43:21 +0200
> Von:  Tilmann <tilmann_...@gmx.de> <mailto:tilmann_...@gmx.de>
> Antwort an:   jdo-user@db.apache.org <mailto:jdo-user@db.apache.org>
> An:   jdo-user@db.apache.org <mailto:jdo-user@db.apache.org>
> 
> 
> Hi,
> I posted this question a while ago on StackOverflow: 
> https://stackoverflow.com/questions/27585579/jdo-semantics-of-deleted-objects 
> <https://stackoverflow.com/questions/27585579/jdo-semantics-of-deleted-objects>
> It didn't get answered yet.
> 
> Here is the question:
> 
> ===========
> 
> I've been studying the JDO 3.0 spec and I'm not sure what the semantics 
> of |delete()| and |refresh()| are supposed to be.
> 
> Suppose I have two optimistic sessions, pm1 and pm2, both access the 
> same object. Pm1 deletes the object and commits. Then what happens in 
> pm2 if:
> 
>  1.
> 
>     pm2 deletes the object and tries to commit, should that work? It's
>     wouldn't be a real conflict if both delete it.
Actually, it would be a conflict. If your application thought it was deleting 
an object but the object wasn’t there, that would be an error. The delete would 
fail and the transaction would fail.
> 
>  2.
> 
>     pm2 modifies the object (make dirty) and calls refresh(). Should I
>     get an ObjectNotFound exception?
Refresh would call the database and try to load the object again and would fail.
>  3.
> 
>     pm2 deletes the object and calls |refresh()|. According to the spec,
>     |refresh()| should not change the object's state. 
That is how I read the spec as well.
> But should it
>     still fail with |ObjectNotFound|? If refresh should fail, how can I
>     ever recover from such a situation, because I can't undelete the
>     object?
Maybe when you file your JIRA, you can describe what you would like to do to 
recover this situation, in as much detail as possible.
> 
> ============
> 
> Could someone point me to some relevant documentation?
The specification sections on life cycle and refresh have some information but 
perhaps not the definitive answers you are looking for.
> 
> Should I maybe write an JIRA bug report to enhance the spec?
That would be a good idea.

Craig


> 
> Cheers,
> Tilmann
> 
> 
> 
> 
> 
> 
> Craig L RussellArchitect, Oraclehttp://db.apache.org/jdo408 276-5638 
> mailto:craig.russ...@oracle.comp.S. A good JDO? O, Gasp!
> 

Reply via email to