Hi guys,
yesterday I was trying to model a simple forum comments. Just a
comments which you can add more comments to.
So, the approximation of the entity is like this:
-------------------------------------------------------------------
@PersistenceCapable (detachable = "true", identityType =
IdentityType.APPLICATION)
public class CommentEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String category;
@Persistent
private String commentDate;
@Persistent
private String userName;
@Persistent
private String commentBody;
@Persistent
private List<CommentEntity> children = new
ArrayList<CommentEntity>();
getters/setters/etc.
}
DataNucleus enhancement goes ok, no errors in the console.
Call of the pm.makePersistent() goes without any exceptions for such
entity.
BUT IT IS NOT PERSISTED.
I found out that problem is in "children" property. And the problem is
it's a list of objects of the same class as the parent entity. If I
comment that property declaration the entity is persisted. Also if I
change the type of the child entities to some new class (not extending
the CommentEntity) it also gets persisted.
So my suspicion is that JDO (or GAE JDO impl) does not allow child
entities to be of the same class. Is it correct? Maybe I'm missing
something essential? Please advice.
Sincerely,
Alex
--
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.