Hi ! I have a problem when I  persist and add a child (class "Equipo")
of an existent class( This class father already persisted, class
"Fecha"). The child class is not persisted and the error is:

    Primary key for object of type Equipo is null.

Caused by:

java.lang.IllegalStateException: Primary key for object of type Equipo
is null.
        at
org.datanucleus.store.appengine.DatastorePersistenceHandler.getPkAsKey(DatastorePersistenceHandler.java:
446)
        at
org.datanucleus.store.appengine.DatastorePersistenceHandler.updateObject(DatastorePersistenceHandler.java:
529)
        at
org.datanucleus.state.JDOStateManagerImpl.flush(JDOStateManagerImpl.java:
4576)
        at
org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:
2814)
        at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:
2754)
....

The class that persist:
Transaction tx = pm.currentTransaction();


                try {
                        tx.begin();
                        Partido par1 = null;
                        Equipo eq1 = this.devolverEquipo(idTorneo, idEqLocal);
                        Equipo eq2 = this.devolverEquipo(idTorneo, 
idEqVisitante);
                        Equipo eq1b = copiarEquipo(eq1);
                        Equipo eq2b = copiarEquipo(eq2);
                        //eq1b  and eq2b  new instances of class
Equipo.
                        par1 = new Partido( eq1b, eq2b,
                                        fecha, hora);

                        fechaAgreg.agregarPartido(par1);
                        FechaNormal fech = (FechaNormal) 
pm.detachCopy(fechaAgreg);
                        pm.makePersistent(fech);
                        tx.commit();
                } finally {

                        if (tx.isActive()) {
                                tx.rollback();

                        }
                }

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to