2011-05-01 07:20:07 |
Matt Giuca |
description |
I am having trouble creating GameData objects and persisting them in the database. I created a GameData object like this (in DataTestServiceImpl.populateDatastore):
GameData[] games = new GameData[] {
new GameData("test", devteams[0])
};
pm.makePersistentAll(games);
Then, clicking the Populate button results in this error at runtime:
> The owner field game of element class au.edu.unimelb.csse.mugle.server.model.AchievementData
> has an incorrect type "au.edu.unimelb.csse.mugle.shared.model.Game". Should be
> "au.edu.unimelb.csse.mugle.server.model.GameData"
That is on the line:
pm.makePersistentAll(games);
I assume this is because we have a class GameData which has a Set<AchievementData> mappedBy "game", but the AchievementData's game field has type Game. I believe that AchievementData's game field should have type GameData. Am I correct?
I replaced all uses of the Game type in AchievementData with GameData. This fixes that error, but now it generates another exception on the same line:
> Class "au.edu.unimelb.csse.mugle.server.model.GameData" has collection field "achievements"
> and this has no mapping in the table for the element class
> "au.edu.unimelb.csse.mugle.server.model.AchievementData" owner field "game"
I can't figure this one out. The GameData.achievements field has type Set<AchievementData> mappedBy "game", and the AchievementData.game field has type GameData. This seems to be the normal way of doing things in https://code.google.com/appengine/docs/java/datastore/jdo/relationships.html, so why is it giving this error? |
I am having trouble creating GameData objects and persisting them in the database. I created a GameData object like this (in DataTestServiceImpl.populateDatastore):
GameData[] games = new GameData[] {
new GameData("test", devteams[0])
};
pm.makePersistentAll(games);
Then, clicking the Populate button results in this error at runtime:
> The owner field game of element class
> au.edu.unimelb.csse.mugle.server.model.AchievementData
> has an incorrect type "au.edu.unimelb.csse.mugle.shared.model.Game". Should
> be "au.edu.unimelb.csse.mugle.server.model.GameData"
That is on the line:
pm.makePersistentAll(games);
I assume this is because we have a class GameData which has a Set<AchievementData> mappedBy "game", but the AchievementData's game field has type Game. I believe that AchievementData's game field should have type GameData. Am I correct?
I replaced all uses of the Game type in AchievementData with GameData. This fixes that error, but now it generates another exception on the same line:
> Class "au.edu.unimelb.csse.mugle.server.model.GameData" has collection
> field "achievements" and this has no mapping in the table for the element
> class "au.edu.unimelb.csse.mugle.server.model.AchievementData" owner
> field "game"
I can't figure this one out. The GameData.achievements field has type Set<AchievementData> mappedBy "game", and the AchievementData.game field has type GameData. This seems to be the normal way of doing things in https://code.google.com/appengine/docs/java/datastore/jdo/relationships.html, so why is it giving this error? |
|