This is not the most elegant or efficient way to do things but here is
something to make your code work.


      public Torneo devolverTorneo(Long idTorneo) {
           Torneo dbTorneo = pm.getObjectById(Torneo.class, idTorneo);
           // detach a copy of the persistent object
           return pm.detachCopy(dbTorneo );
       }

       public void agregarEquipoConTorneo(Torneo unTorneo, Equipo
unEquipo) {
               Transaction tx = pm.currentTransaction();

               try {
                   tx.begin();
                   // sync unTorneo with database before changing it
                   Torneo dbTorneo = pm.makePersistent(unTorneo);
                   dbTorneo.agregarEquipo(unEquipo);
                   /*add an "Equipo" to collection "equipos" That has
the class "Torneo"
                   Debugs adds, but sometimes he does not persist*/

                   tx.commit();
                    System.out.println("persistioTorneoConEquipo");
               } finally {

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

               }
       }


Another way to do all this is to redesign your ControladorTorneo class to
only store the ID of the Torneo and fetch it from the database in the
transaction you want to change it.
 public void agregarEquipoConTorneo(  torACargar, Equipo unEquipo)...

-- 
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 [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-java?hl=en.

Reply via email to