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 749329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:25:19+00:00 2026-05-14T14:25:19+00:00

i’ve three entity classes in my project public class Blobx { @ManyToOne private Userx

  • 0

i’ve three entity classes in my project

public class Blobx {
@ManyToOne
private Userx user;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;
}

public class Index  {
@Id
private String keyword;
@OneToMany(cascade = CascadeType.PERSIST)
private List<Blobx> blobs;
}

public class Userx  {
@Id
private String name;  
@OneToMany(mappedBy = "user")
private List<Blobx>blobs;
}

while running the following lines app engine throws an exception

    em.getTransaction().begin();
    em.persist(index);
    em.getTransaction().commit();//exception is thrown
    em.close();

as

Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element 


{
    type: "Index"
   name: "function"
  }
  and Element {
    type: "Userx"
    name: "18580476422013912411"
  }

i can’t understand what’s wrong?

  • 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-14T14:25:20+00:00Added an answer on May 14, 2026 at 2:25 pm

    What’s happening (based on the error message) is that you’re trying to persist the Index, which contains Blobxes, which contain Userxes, which are all in different entity groups, in a transaction. When you call em.persist(index), it will cascade persist all the entities inside it, and all those inside them.

    Think of an entity group as a cluster of machines. Some of your Indexes are on Cluster A, in Nevada. The Blobxes contained within are on Cluster B, in Maine, and the Userxes contained in there are in Clusters B and C, in Texas and Oregon. How they all ended up there is entirely random, and (with your code as it is) entirely out of your control. Asking App Engine to persist all of these geographically disparate entities and know when one fails (i.e., in a transaction) is nearly impossible, and would require a ton of network cross-talk to have all parties know that all other parties are doing okay. So it’s not allowed.

    What you want to do is make sure Google puts all your entities in one Entity Group, which will mean that they’re all in one (geographical) place. To do that, read the docs for Transactions, which describe how to make sure your entities end up in the same entity group, which means they’ll be able to have a transaction worked on all of them.

    Now, entity-grouping things has its downsides. Namely slowness, and uneven utilization of the datastore (e.g., now that all your entities will be in Texas, users in Oregon will see unnecessary slowness!), so only use entity groups if you absolutely need to use transactions on all entities. For example, don’t use a cascading persist unless you actually have to, or don’t do it in a transaction unless you actually have to.

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

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've not seen this done much, as it basically prevents… May 14, 2026 at 6:10 pm
  • Editorial Team
    Editorial Team added an answer This is the code: $('div.toggle_container').each(function() { // Initialise var index… May 14, 2026 at 6:09 pm
  • Editorial Team
    Editorial Team added an answer its some what related to JSP too it can be… May 14, 2026 at 6:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.