I use the 2nd method in a transaction in my app.
When creating the 2 entities, there is no problems.
But when I updating the 2 entities, error ocuurs and the log saids:
"java.lang.IllegalArgumentException: can't operate on multiple entity
groups in a single transaction. "

On Jul 7, 6:42 am, Tapir <tapir....@gmail.com> wrote:
> Based on the example in the "Creating Entities With Entity Groups"
> section 
> ofhttp://code.google.com/appengine/docs/java/datastore/transactions.htm...
>
> 1.
>
>         KeyFactory.Builder keyBuilder = new
> KeyFactory.Builder(Customer.class.getSimpleName(), "custid985135");
>         Key parentKey = keyBuilder.getKey();
>         keyBuilder.addChild(AccountInfo.class.getSimpleName(),
> "acctidX142516");
>         Key key = keyBuilder.getKey();
>
>         Customer cust = new Customer ();
>         cust.setKey(parentKey);
>
>         AccountInfo acct = new AccountInfo();
>         acct.setKey(key);
>         pm.makePersistentAll(cust, acct);
>
> 2
>
>         Key parentKey = KeyFactory.createKey
> (Customer.class.getSimpleName(), "custid985135");
>         Key key = KeyFactory.createKey (parentKey,
> AccountInfo.class.getSimpleName(), "acctidX142516");
>
>         Customer cust = new Customer ();
>         cust.setKey(parentKey);
>
>         AccountInfo acct = new AccountInfo();
>         acct.setKey(key);
>         pm.makePersistentAll(cust, acct);

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to