This code is to save the object FaseGAE:
manager = GAEDAOFactory.get().getPersistenceManager();
Key faseKey = KeyFactory.stringToKey(grupo.getFaseKey());
FaseGAE faseGAE = manager.getObjectById(FaseGAE.class, faseKey);
faseGAE.addGrupoGAE(grupoGAE);
faseGAE = manager.makePersistent(faseGAE);
manager.close();
This code is to get the object:
manager = GAEDAOFactory.get().getPersistenceManager();
FaseGAE faseGAE2 = manager.getObjectById(FaseGAE.class, faseKey);
FaseGAE object:
@PersistenceCapable
public class FaseGAE {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent private List<GrupoGAE> grupos;
GrupoGAE object:
@PersistenceCapable
public class GrupoGAE {
@PrimaryKey
@Persistent (valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent private List<MyClass1> list;
MyClass1 object:
@PersistenceCapable
public class MyClass1 {
@PrimaryKey
@Persistent (valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent private MyClass2 sameTypeObject1;
@Persistent private MyClass2 sameTypeObject2;
@Persistent private String testValue1;
@Persistent private String testValue2;
MyClass2 Object:
@PersistenceCapable
public class MyClass2{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
testValue1 and testValue2 keeps different values, but sameTypeObject1
and sameTypeObject2 have the value of sameTypeObject2. I checked the
datastore and both objects were created with different values. It
seems like both point to the same reference.
Am I doing something wrong?
Something it's missing to work with same type relations?
Definitely AppEngine doesn't allow same type relations?
PLS HELP!!!!!
On Jun 17, 4:05 am, Robert Kluin <[email protected]> wrote:
> Hi,
> You might want to include some of the relevant code, such as your
> model definitions and the code that sets and persists the entities.
> Also note that there is a Java specific group; might have a better
> chance of a Java whiz spotting it and helping you out there.
>
> Robert
>
>
>
>
>
>
>
> On Tue, Jun 14, 2011 at 12:45, david <[email protected]> wrote:
> > Hi,
>
> > I have 3 classes: MyClass, MySubClass and ProblemClass
> > The first one have two MySubClass objects: MySubClass1 and MySubClass2
> > Each MySubClass has a ProblemClass object: ProblemClass1 and
> > ProblemClass2
>
> > Just before call 'manager.makePersistent(MyClass);' I checked the
> > attribute in both ProblemClass objects and they were differents (That
> > ´s OK).
> > But when I tried to recover MyClass object from the datatore the
> > attributes inside the ProblemClass objects are equal (THAT'S WRONG).
> > Both ProblemClass have the values of ProblemClass2
>
> > Checking the datastore I saw both ProblemClass objects were created
> > (With correct values), however MySubClass1 and MySubClass2 seems to be
> > pointing to the same ProblemClass
>
> > All classes have the same key type:
>
> > @PrimaryKey
> > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> > private Key key;
>
> > Am I doing something wrong? Is something missing to work with same
> > type relations? Definitely AppEngine doesn't allow same type
> > relations?
>
> > PLS HELP!!!!! I'm really stuck!!!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" 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
> > athttp://groups.google.com/group/google-appengine?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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?hl=en.