Does it work recurential?
so lets say I have classes:
Person
{
List<Address> adresses;
}
Address
{
Telephone telephone;
}
I should write
.findAll().with("adresses", "telephone").fire(...)
?
greetings,
agi
On Oct 19, 11:29 am, Thomas Broyer <[email protected]> wrote:
> On 19 oct, 09:56, keyvez <[email protected]> wrote:
>
>
>
>
>
> > My EntityProxy looks like this
>
> > @ProxyFor ( User.class )
> > public interface UserProxy extends EntityProxy {
>
> > Long getId();
>
> > String getFirstname();
>
> > String getLastname();
>
> > Set<String> getAddresses();
>
> > void setAddresses( Set<String> addresses );
>
> > }
>
> > And my Entity class look like this:
>
> > @Entity
> > public class User {
>
> > @Id
> > @GeneratedValue ( strategy = GenerationType.IDENTITY )
> > private Long id;
>
> > @NotNull
> > private String firstname;
>
> > @NotNull
> > private String lastname;
>
> > private Set<String> addresses;
>
> > public void setAddresses( Set<String> addresses ) {
>
> > this.addresses = addresses;
> > }
>
> > public Set<String> getAddresses() {
>
> > if ( addresses == null ) {
> > addresses = new HashSet<String>();
> > }
> > return addresses;
> > }
>
> > }
>
> > When I make a request using RequestFactory like so:
>
> > Request<UserProxy> createReq = request.authenticate().using(user);
>
> > createReq.fire(new Receiver<UserProxy>() {
>
> > @Override
> > public void onSuccess( UserProxy authenticatedUser ) {
>
> > System.out.println(authenticatedUser.getFirstname()); //
> > prints "First name of Person" as expected
>
> > System.out.println(authenticatedUser.getAddresses().size()); // prints
> > 0 instead of the no. of addresses, which is more than 0 for this user
>
> > }
>
> > });
>
> > I am using JPA on app engine.
>
> > It look like RequestFactoryServlet is not able to properly serialize
> > collection properties of datastore objects. Any help in this regard
> > would be greatly appreciated.
>
> You have to explicitly ask for relationships to be populated.
>
> """When querying the server, RequestFactory does not automatically
> populate relations in the object graph. To do this, use the with()
> method on a request and specify the related property name as a
> String"""http://code.google.com/webtoolkit/doc/trunk/DevGuideRequestFactory.ht...
--
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.