Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7658361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:11:30+00:00 2026-05-31T13:11:30+00:00

i have a quick question about objectify – this may be in the actual

  • 0

i have a quick question about objectify – this may be in the actual documentation but i haven’t found anything so i’m asking here to be safe.

i have a backend using objectify that I kind of rushed out – what i would like to do is the following – i have an event plan that is made up of activities. currently, if i delete an event i am actually writing in all of the logic to delete the individual activities inside the event plans delete method.

what i’m wondering is, if i call the activitys delete method from the event plans delete method (if it lets me do this), is it atomic?

sample (this is just pseudo code – not actual – case and method names may be wrong):

// inside event plan dao
public void delete(EventPlan eventPlan) {
  final Objectify ofy = Objectify.beginTransaction();
  try {
    final ActivityDAO activityDao = new ActivityDAO();
    for (final Activity activity : eventPlan.getActivities()) {
      activityDao.delete(activity);
    }
    ofy.getTxn().commit();
  } finally {
    if (ofy.getTxn().isActive()) {
      ofy.getTxn().rollback();
    |
  }
}


// inside activity dao
public void delete(Activity activity) {
  final Objectify ofy = Objectify.beginTransaction();
  try {
    // do some logic in here, delete activity and commit txn
  } finally {
    // check and rollback as normal
  }
}

is this safe to do? – as it is right now, the reason it’s so mangled is because i didn’t realize the entity group issue – there were certain things in the activity that were not in the same entity group as the activity itself – after fixing this i put all of the logic in the event plan delete and the method is becoming unmanageable – is it ok to break stuff down into smaller pieces or will it break atomicity.

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:11:31+00:00Added an answer on May 31, 2026 at 1:11 pm

    Nested transactions do not happen in a single atomic chunk. There is not really any such thing as a nested transaction – the transactions in your example are all in parallel, with different Objectify (DatastoreService) objects.

    Your inner transactions will complete transactionally. Your outer transaction doesn’t really do anything. Each inner delete is in its own transaction – it is still perfectly possible for the first Activity to be successfully deleted even though the second Activity is not deleted.

    If your goal is to delete a group of entities all-or-nothing style, look into using task queues. You can delete the first Activity and enqueue a task to delete the second transactionally, so you can be guaranteed that either the Activity will be deleted AND the task enqueued, or neither. Then, in the task, you can do the same with the second, etc. Since tasks are retried if they fail, you can control the behavior to be sort of like a transaction. The only thing to beware of are results in other requests including the partially-deleted series during the process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A quick question about saving data in symfony 2. I have this method (just
I have a quick question about jQuery selectors. Is doing this: $('.class_el_1, .class_el_2').hide(); The
A quick question about the UISegmentedControl class on the iPhone. Hopefully, some may have
I have a quick question about changing the file types PHP parses. This website
I have a quick question about fetching results from a weakly typed cursor and
I have a quick question about encapsulating specific types with typedef . Say I
I just have a quick question about how to get the length of a
i have what i hope is a quick question about some code i am
I have quick question about jQuery plugins, hope somebody out there has some advice.
Have a quick question about what would be the best way to implement iterators

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.