I have defined two classes named TotalInformation and UrlInformation:
________________________________
TotalInformation:
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private int urlNumber;
UrlInformation
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String url = new String();
@Persistent
private String code = new String();
_______________________________________________
Both have no reference to each other.
I retrieve TotalInformation and make a key to create a UrlInformation
in the same transaction and finally i store them like this :
__________________________
tx.begin();
code = UrlConverter.getStringByNumber(total.getUrlNumber());
total.setUrlNumber(total.getUrlNumber() + 1);
KeyFactory.Builder keyBuilder = new
KeyFactory.Builder(TotalInformation.class.getSimpleName(),PropertiesGetter.getProperty("administation.totalInfomation.id"));
keyBuilder.addChild(UrlInformation.class.getSimpleName(), code);
Key key = keyBuilder.getKey();
UrlInformation thisUrl = new UrlInformation();
thisUrl.setKey(key);
//........
pm.makePersistent(thisUrl);
tx.commit();
pm.close();
_______________________________
the transaction didn't rollback which i suppose the two entities are
in the same entities group and i found two entities in "http://
localhost:8888/_ah/admin" and found the two entities with the keys
below respectively:
TotalInformation:
agpqaWFuZy1zZmdsciELEhBUb3RhbEluZm9ybWF0aW9uIgsxNTAxNzUwMjEyNQw
UrlInformation:
agpqaWFuZy1zZmdscjYLEhBUb3RhbEluZm9ybWF0aW9uIgsxNTAxNzUwMjEyNQwLEg5VcmxJbmZvcm1hdGlvbiIBMQw
But when i create keys to retrieve UrlInformation and TotalInformation
and i encounter :
javax.jdo.JDOFatalUserException: Illegal argument
NestedThrowables:
java.lang.IllegalArgumentException: can't operate on multiple entity
groups in a single transaction. found both Element {
type: "TotalInformation"
name: "15017502125"
}
and Element {
type: "UrlInformation"
name: "d"
}
--
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 [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.