Appengine JDO dataclasses to python model
- by M.A. Cape
Does anyone have tried to implement an app in GAE having both java and python?
I have an existing app and my front end is in java. Now I want to use the existing datastore to be interfaced by python. My problem is i don't know how to define the relationships and model that would be equivalent to the one in java. I have tried the one-to-many relationship in python but when stored in the datastore, the fields are different than the one-to-many of java.
My data classes are as follows.
//one-to-many owned
Parent Class
public class Parent{
@PrimaryKey
@Persistent
private String unitID;
//some other fields...
@Persistent
@Order(extensions = @Extension(vendorName="datanucleus", key="list-ordering", value="dateCreated desc"))
private List <Child> child;
//methods & constructors were omitted
}
Child
public class Child{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key uId;
@Persistent
private String name;
/* etc... */
}