I have been trying to learn and creating a sample project using GWT/GAE/GoogleDatastore.
Am just trying to figure out what would be the best way to design the data model for a learning management system. Let's say in the traditional way the following are the entities.....
User
Role
UserCourses
Courses
Subjects
Materials
User is one to one to Role
Courses is one to many with Subjects
Subjects is one to many with Materials
Users is Many to Many with Courses using UserCourses
Can someone guide me what would be the best possible way to represent this in JDO ?
---> Extension of the question.
Thank You Shifty, but am completely stuck with unowned relationship model... trying/struggling to come out of the traditional relational model.
Let me take the simple Subjects vs Materials
Am trying out the following model,
@PersistenceCapable(identityType = IdentityType.APPLICATION) public class Subjects {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
private String id;
@Persistent
private List<Materials> materials;
}
public class Materials{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
private String id;
@Persistent
private String materialName;
@Persistent
private String author;
@Persistent
private String materialType;
@Persistent
private String url;
}
When i try to save the materials first and then assigning that object into subjects is having issues. As i read, you cannot assign the child to a parent which is already persisted without parent.
Sometimes it is possible to add materials without assigned to the Subjects, but can get assigned later on.