Hi All,
I'm running into a strange problem with RequestFactory persisting a
Parent / Child object graph. What it looks like is happening is that
when my object graph is sent to the server side all of the child
object properties are being set to null for some reason. During
debugging I can verify that right up until the .fire() event occurs
the Child objects are populated correctly with properties, but if I
place a breakpoint @ the Parent.setChildren(List<Child> children);
method I can see that a correctly sized arraylist of essentially null
child objects is being set. Has anybody run into this before? Or have
any thoughts on where I should be directing my searching?
My Setup is as follows (GWT 2.1.1, RequestFactory, Hibernate):
The classes involved are fairly simple...
@Entity
public class Parent{
... Some entity Attributes (Id, Version etc.)
@OneToMany (cascade = {CascadeType.ALL})
@JoinColumn(name="parent_id")
List<Child> children
}
@Entity
public class Child{
... Some Entity Attributes (Id, Version etc.)
}
My Save method looks something like this:
void onSaveClick(ClickEvent event){
ParentProxy.setPropertyA(propertyA.getText());
ParentProxy.setPropertyB(propertyB.getText());
ParentProxy.setChildren(constructChildren());
requestContext.persist().using(ParentProxy).with("children").fire(new
Receiver<Void>(){
@Override
public void onSuccess(Void response){
// Update UI here.
}
}
}
constructChildren looks like this:
public ArrayList<ChildProxy> constructChildren(){
ArrayList<ChildProxy> results = new ArrayList<ChildProxy>();
for (ChildrenToProcess c : childrenToProcess){
ChildProxy child =
requestFactory.childRequest().create(ChildProxy.class);
child.setPropertyA(c.getPropertyA);
// More setting of properties etc.
results.add(child);
}
return results;
}
Any help would be greatly appreciated.
Thanks all!
Ryan Rathsam
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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-web-toolkit?hl=en.