El gráfico de objetos GWT del servidor está vacío después de guardar

When I create a new proxy on the client, with a list of new child proxies, and persist the graph to the server, I only get back the root node. I have verified that the server is correctly saving the graph and returning the graph, but GWT fails to load these as proxies on the client.

Tengo los modelos:

class TripProxy {
   List<PatronProxy> getPatrons();
   void setPatrons(List<PatronProxy> patrons);

   // some other fields

class PatronProxy {
   void setName(String name);
   String getName();

My editor creates a new trip where one or more patrons can be added to the trip. The save method looks something like:

Trip save(Trip trip);

Which simply saves what was given and returns it back. Why does the returned trip not include the Patrons that were attached? I am specifying a proper with(...) statement with my call to save. I know this because when I later edit the trip (after refreshing the browser) I am able to see the patrons.

preguntado el 01 de febrero de 12 a las 03:02

1 Respuestas

Dices que eres "specifying a proper with(...) statement" but can you show it?

Debido a que el with() is only related to what's being returned from the server, your "I know this because ..." makes no sense: it only validates the fact that your objects have been saved, and the with() of your retrieval method is OK, not the with() of the save() method.

Tu llamada a save() debería verse así:

ctx.save(tripProxy).with("patrons").to(new Receiver<TripProxy>() { ... });

(feel free to replace to() con fire() if you want to fire the context right there instead of later one)

Respondido 01 Feb 12, 16:02

My 'with' looks like: with("patrons", "origin", "destination"). Origin and destination are each AddressProxy's that are also newly created as well. These two properties are correctly returned from the server whereas the patrons property is not. My porque was referring to when the trip proxy was later fetched from the server on edit; not the actual saving after editing. - Brad

OK, I better understand now. Could you show your server code for the Trip save(Trip trip) method? Do you batch other methods in your RequestContext? - Thomas Broyer

No, I dont batch but I think I found it. I usually try to simplify my problem when asking questions on SO and it looks like I simplified this one too much. When I looked at the save method again, I found the problem. Completely my fault. Thanks for you help! - Brad

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.