Hi guys, I'm trying to use the datastore with a model like this:
Class A extends C
{
@Persistent
private String a1;
}
Class B extends C
{
@Persistent
private String b1;
@Persistent
private D dAttribute;
}
Class D
{
@Persistent
private String d1;
}
Class C
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private double c1;
@Persistent
private double c2;
}
How should I declare this in Java?
How can I make queries? The following queries are failing and I don't
can't find more help!
public List<A> get( String minC1, String maxC1 ) {
PersistenceManager pm = WherePersistanceManagerFactory.get
().getPersistenceManager();
Query query = pm.newQuery(A.class);
query.setFilter("c1 >= " + minC1 + " && c1 <= " + maxC1);
return (List<A>) query.execute();
}
public List<B> get( String minC1, String maxC1 ) {
PersistenceManager pm = WherePersistanceManagerFactory.get
().getPersistenceManager();
Query query = pm.newQuery(B.class);
query.setFilter("c1 >= " + minC1 + " && c1 <= " + maxC1 + " &&
dAttribute.d1 = someConstant");
return (List<B>) query.execute();
}
I can't understand how to store/retrieve classes that inherit from
other classes or classes as attributes of other classes. I always get
an error saying that the subclass hasn't got the superclass attribute
or that the class that has a reference to the other class cannot find
that attribute.
Can anyone help me?
Thanks!
--
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.