Monday, May 28, 2012

Re: RequestFactory 2.4: save entities with multiple sub entities, can only get the first one at server side.

Thank you guys, i changed to List and it works. 
BTW before i use EntityProxy in Set which lead to error, other than ValueProxy

On Tue, May 29, 2012 at 2:04 PM, Ashwin Desikan <ashwin.desikan@gmail.com> wrote:
Additionally, try using List instead of Set. It works for me when I faced similar issues. Only problem would be you will have to manage any redundancy with List

~Ashwin

Sent from my iPhone

On May 29, 2012, at 11:20 AM, Thomas Broyer <t.broyer@gmail.com> wrote:

There are unfortunately many small but annoying issues with RF in 2.4; most of them will be fixed in 2.5, to be released in a month or so.
Have a look at the issue tracker, I seem to recall having worked on patches for issues with ValueProxies and Sets (assuming TagProxy is a ValueProxy).

On Tuesday, May 29, 2012 7:02:08 AM UTC+2, July wrote:
I'm using GWT requestFactory to save an entity, the code is rather simple: i want to create a Blog entity with several Tags, here is my code:

client side:

         BlogRequest blogRequest = factory.blogRequest();
        BlogProxy  instance  = blogRequest.create(  BlogProxy .class );

        instance.setName( "blog name");
        instance.setNote( "mynote2" );
        instance.setTags( base.createTagProxies( blogRequest, tag ) );

        blogRequest.save( instance ).fire(...);


    public Set<TagProxy> createTagProxies( BlogRequest request, String... tagNames )
    {
        Set<TagProxy> tagproxies = new HashSet<TagProxy>();
        for( String tagName : tagNames )
        {
            TagProxy proxy = request.create( TagProxy.class );
            proxy.setName( tagName );
            tagproxies.add( proxy );
        }
        return  tagproxies  ;
    }

for example i create a blog with "Tag1" and "Tag2" in a Set, however after the request send to server side, at Blog#setTags(Set<Tag> tags) method there is only one tag in the parameter set, which is "Tag1", "Tag2" is just missing.

Could anybody help with this issue? Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/2Nnf11Vk2xQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment