Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4241952
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:22:39+00:00 2026-05-21T03:22:39+00:00

I have been trying to learn and creating a sample project using GWT/GAE/GoogleDatastore. Am

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:22:40+00:00Added an answer on May 21, 2026 at 3:22 am

    if you want to make a many-to-many relationship with GAE and JDO you have to store a list of the keys in the models.

    User Model

    import java.util.Set;
    import com.google.appengine.api.datastore.Key;
    
    @PersistenceCapable
    public class User {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;
        @Persistent
        private Set<Key> courses;
    }
    

    Courses Model

       import java.util.Set;
        import com.google.appengine.api.datastore.Key;
    
        @PersistenceCapable
        public class Courses {
            @PrimaryKey
            @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
            private Key key;
            @Persistent
            private Set<Key> users;
        }
    

    this way you don’t need the UserCourses class.

    EDIT:

    If you use

    @Persistent
    private List<Materials> materials;
    

    you work with a owned relationship model.
    this way you can not persist the model first and then add this to the subject model and the persist the subject model.
    Just add the not persistent material to the materials list of the subject model and persist the subject model. this will also save the materials.

    maybe I could the question wrong but I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for the last hour I have been trying to figure this out myself but
I have been trying to learn MVVM using Laurent Bugnion MVVM light method. I
I have been trying to learn Vim and have been using it for 2
I have been trying to learn multi-threaded programming in C# and I am confused
I have been trying to learn how to add testing to existing code --
I have been trying to learn more about lambda expressions lately, and thought of
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have been trying to work my way through Project Euler, and have noticed
So I have been trying to recreate Pong in Box2D to learn how to
i have been trying to learn PHP Repeat Region... i have searched google but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.