Hi all,

I’m trying to model my domain to use GAE JDO. I have User and Event classes 
(see below). 

An Event is owned by a User and a User can participate in their and others 
Events.

My issue is that I’m having trouble persisting the participate in another 
User’s Event. I keep getting:

java.lang.IllegalArgumentException: can't operate on multiple entity groups 
in a single transaction. found both Element {
 type: "User"
 id: 1
}
and Element {
 type: "User"
 id: 7
}


I see its because I’m updating multiple top level entities... but I’m not 
sure how to update the entities separately given the own/participates 
references... any suggestions appreciated!

@PersistenceCapable(detachable = "true")
public class User implements Serializable 
{

@PrimaryKey

@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

private Key id; 

// owned one-to-many with event

@Persistent(mappedBy = "owner")

private List<Event> ownsEvents = new ArrayList<Event>();

// many to many

private Set<Key> participatesInEvents = new HashSet<Key>();
}

@PersistenceCapable(detachable = "true")
public class Event implements Serializable 
{

@PrimaryKey

@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

private Key id; 

// owned one-to-many with user

private User owner;

// many to many with user

private Set<Key> participants = new HashSet<Key>();
}

-- 
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/-/POgG9W3Rli4J.
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.

Reply via email to