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!!!!!