Hi,
I´m new to GAE and I have a problem with the datastore.
I add 2 new entities not in a transaction and I get the Exception:
javax.persistence.PersistenceException: Illegal argument
at
org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForJDOException(NucleusJPAHelper.java:
214)
....
Caused by: java.lang.IllegalArgumentException: can't operate on
multiple entity groups in a single transaction. found both Element {
type: "En"
id: 1
}
and Element {
type: "En"
id: 2
}
I know the two entities are not in the same entity group, but I
persisted them not in a transaction.
here is the code:
---
public class CreateSomeObjects
{
private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());
public CreateSomeObjects()
{}
@Before
public void setUp()
{ helper.setUp(); }
@After
public void tearDown()
{ helper.tearDown(); }
@Test
public void createWithoutTA1()
{ try
{ EntityManager em = Gae.emfInstance.createEntityManager();
En e;
e=new En("Nummer1");
em.persist(e);
e=new En("Nummer2");
em.persist(e);
em.close();
} catch (Exception ex)
{ ex.printStackTrace();
fail("unerwartete Exception: "+ ex.getMessage());
}
}
}
---
@Entity
public class En implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;
private String name;
public En()
{}
public En(String name)
{ this.name = name; }
public Key getId()
{ return id; }
public void setId(Key id)
{ this.id = id; }
public String getName()
{ return name; }
public void setName(String name)
{ this.name = name; }
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
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?hl=en.