Re: [appengine-java] Accessing the last committed timestamp using datastore API?

2010-05-17 Thread Ikai L (Google)
This isn't available in the low level API. Transactions are already using
the implementation you've described via optimistic locking.

There's an article written by Max Ross about using the @Version annotation
to achieve the same thing. Check it out:

http://gae-java-persistence.blogspot.com/2009/10/optimistic-locking-with-version.html

On Thu, May 13, 2010 at 11:54 PM, brendan brendanpdohe...@gmail.com wrote:

 Slide 54 of Under the Covers of the Google App Engine Datastore by
 Ryan Barrett states that the last committed timestamp co-located with
 root entity.  Is it possible to access this last committed timestamp
 using the low level datastore API?

 I'd like to be able to access it to create an enhancement to objectify
 that provides optimistic locking.

 My idea is:
 - On get(), populate a field in the entity just read with the
 timestamp.  Probably the field would have an @Lock annotation.
 - Send entity to gwt client over rpc.
 - Receive entity back from gwt client over rpc.
 - On put(), before update check the timestamp and fail if their is a
 difference.

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Relations, Google App Engine
Twitter: http://twitter.com/ikai
Delicious: http://delicious.com/ikailan


Google App Engine links:
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Accessing the last committed timestamp using datastore API?

2010-05-13 Thread brendan
Slide 54 of Under the Covers of the Google App Engine Datastore by
Ryan Barrett states that the last committed timestamp co-located with
root entity.  Is it possible to access this last committed timestamp
using the low level datastore API?

I'd like to be able to access it to create an enhancement to objectify
that provides optimistic locking.

My idea is:
- On get(), populate a field in the entity just read with the
timestamp.  Probably the field would have an @Lock annotation.
- Send entity to gwt client over rpc.
- Receive entity back from gwt client over rpc.
- On put(), before update check the timestamp and fail if their is a
difference.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.