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

  • Home
  • SEARCH
  • 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 645271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:29:01+00:00 2026-05-13T21:29:01+00:00

Why am I receiving the exception below if the type of both entities is

  • 0

Why am I receiving the exception below if the type of both entities is PersistentLogin? I thought that would mean they are in the same entity group, but I guess that is an incorrect assumption. Any ideas how to fix this?

This is the code:

// the class is marked with @Transactional
@Override
public final void removeUserTokens(final String username) {
    final Query query = entityManager.createQuery(
        "SELECT p FROM PersistentLogin p WHERE username = :username");
    query.setParameter("username", username);

    for (Object token : query.getResultList()) {
        entityManager.remove(token);
    }
}

This is the exception:

Caused by: javax.persistence.PersistenceException: Illegal argument
    at org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:260)
    at org.datanucleus.jpa.EntityTransactionImpl.commit(EntityTransactionImpl.java:122)
    at org.datanucleus.store.appengine.jpa.DatastoreEntityTransactionImpl.commit(DatastoreEntityTransactionImpl.java:50)
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467)
    ... 42 more
Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element {
  type: "PersistentLogin"
  name: "1WfCYx8bmwUGkjzP2PpmFA=="
}
 and Element {
  type: "PersistentLogin"
  name: "SfI0P8RVBjTvu0WHMSuaVA=="
}
  • 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-13T21:29:02+00:00Added an answer on May 13, 2026 at 9:29 pm

    Same entity group means that the entities have a common parent entity.

    Two top-level entities are never in the same entity group.

    Any ideas how to fix this?

    The easiest way is to relax the transaction requirements. In your case that would mean deleting the PersistentLogin entities one by one (best effort loop, delete as much as you can, retry on errors, no guarantee of atomicity).

    If you wanted to put the PersistentLogin for the same user in the same entity group, you would need to make rather big changes to your data model, with uncertain impact on overall performance.

    With non-relational databases, you have to code your application without relying on transactions on the data store. They just do not support them to the extent that we have become used to.

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

Sidebar

Related Questions

I am receiving a compile time error saying: No exception of type InputMismatchException can
I'm using the code below and receiving the FileNotFound exception. Can anyone explain why
I'm receiving an exception when parsing the following date: SimpleDateFormat sdf = new SimpleDateFormat(EEE
I'm receiving an unhandled exception while debugging, and the program stops executing. The debugger
I am receiving Invalid Index COM exception when calling Excel.AddIns.Item[0] . Excel.AddIns.Count works all
I'm receiving an Action Controller exception on the 'new' path of http://bob.dev/assessments/new . I
Error below are fixed by removing the declaration but another has appeared that did
I have a entity that has a scalar string property Clarified. Clarified can have
We are receiving a crash log from iTunes connect that is a little strange.
I'm trying to Deserialize a SoapException message that I am receiving from a web

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.