I think that it will have same behavior if I replace
@Transaction(rollbackOn=Exception.class)
public void myMethod() {
}
with
Transaction txn = datastore.beginTransaction();
try {
myMethod();
txn.commit();
} finally {
if (txn.isActive()) {
txn.rollback();
}
}
The problem with my case is that these are really rare situations that are
occurring once or twice in month, but I will change it on that way and will
send another message if I get the same problem again.
The thing that bothers me now is:
*
*
*Note:* If your app receives an exception when submitting a transaction, it
does not always mean that the transaction failed. You can receive
DatastoreTimeoutException<http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreTimeoutException.html>
,
ConcurrentModificationException<http://download.oracle.com/javase/1.5.0/docs/api/java/util/ConcurrentModificationException.html>,
or
DatastoreFailureException<http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreFailureException.html>
exceptions
in cases where transactions have been committed and eventually will be
applied successfully. Whenever possible, make your datastore transactions
idempotent so that if you repeat a transaction, the end result will be the
same.
So as the documentation says, the behavior of transactions is working as
expected, and if I want to make it right, I have to be sure that my
identifiers would be same if the user do the same operation again.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine-java/-/IzdQj55GrmoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.