Objects are re-persisted if there are any fields that are marked "dirty". Sometimes, when you add objects to a collection property, since the property reference may not be marked "dirty", it will not be repersisted when the PersistenceManager is closed. You can either:
1. Call JDOHelper.makeDirty(entity, field) to mark the field as dirty 2. Create a new, equivalent collection and point the equipos reference to it 3. (98% sure this works) Change a value in another property, causing the entire Entity to be persisted (App Engine entities are persisted whole, not piecemeal as you might do in a relational database) -- Ikai Lan Developer Programs Engineer, Google App Engine Blogger: http://googleappengine.blogspot.com Reddit: http://www.reddit.com/r/appengine Twitter: http://twitter.com/app_engine On Wed, Dec 29, 2010 at 6:53 AM, lisandro <lisandr...@gmail.com> wrote: > > lisandrodc > View profile > More options Dec 29, 11:26 am > Hi! I have a problem with the persistence of an existing object > "Torneo" (with a empty collection of objects "Equipo"). > When I add elements to the collection and want to persist, > sometimes persist and sometimes not persist in the > datastore(Restarting the server of the application). The code of > example: > public void agregarEquipoConTorneo(Torneo unTorneo, Equipo unEquipo) > { > /*add Equipo with a existing "Torneo" in the > datastore, the "unTorneo"(param) class obtain with: > Torneo b = > pm.getObjectById(model.Torneo.class, idTorneo);*/ > Transaction tx = pm.currentTransaction(); > try { > tx.begin(); > unTorneo.agregarEquipo(unEquipo); > //add unEquipo to collection "equipos" > pm.makePersistentAll(unTorneo); > tx.commit(); > System.out.println("persistioTorneoConEquipo"); > } finally { > pm.close(); > if (tx.isActive()) { > tx.rollback(); > } > } > Does it design someone of what this one happening? > Thanks! > Regards > Lisandro > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appeng...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://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 google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.