Hi,
Glad to see some reasonable inheritance support in Datastore. However,
I'm a little puzzled. I am trying to setup a simple persistent class
hierarchy, in which the base class defines some standard audit fields
shared by all concrete persistent classes:
public abstract class AbstractEntity implements StoreCallback {
@Persistent
private Date created;
@Persistent
private Date modified;
public final Date getCreated() {
return created;
}
public final Date getModified() {
return modified;
}
@Override
public void jdoPreStore() {
if (this.created == null) {
this.created = new Date();
}
this.modified = new Date();
}
}
The plan was then to have concrete classes extend from this abstract
class and provide the identity field as well as other functional
fields, e.g.:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account extends AbstractEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key accountId;
...
}
What JDO annotations would you suggest putting on the AbstractEntity
class to make it work? Everything I tried ends up with either "class
not enhanced" at runtime or complains about the lack of identity field
on the abstract class. "Well, duh!" to the latter error message I'd
say.
Any suggestions are welcome.
Thanks,
Yegor
--
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.