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

43 views
Skip to first unread message

July

unread,
May 29, 2012, 1:02:08 AM5/29/12
to google-we...@googlegroups.com
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.

Thomas Broyer

unread,
May 29, 2012, 1:50:40 AM5/29/12
to google-we...@googlegroups.com
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).

Ashwin Desikan

unread,
May 29, 2012, 2:04:28 AM5/29/12
to google-we...@googlegroups.com
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
--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

July G

unread,
May 29, 2012, 2:58:01 AM5/29/12
to google-we...@googlegroups.com
Thank you guys, i changed to List and it works. 
BTW before i use EntityProxy in Set which lead to error, other than ValueProxy
Reply all
Reply to author
Forward
0 new messages