Using EntityProxyId as service method parameter

35 views
Skip to first unread message

strcin

unread,
Jan 19, 2012, 10:23:14 AM1/19/12
to Google Web Toolkit
Hello,

What is the correct way of using EntityProxyId<ProxyType> as a service
method parameter?

This question was asked at least once since the release of gwt2.1.1
but was never answered.
I tried to use EntityProxyId<DomainTypeProxy> on the client side and
DomainType on server side but it wouldn't work.
As the app I'm working on is still on 2.1 this was not a pressing
issue for me so I put it aside for a while occasionally trying it
again on each new gwt release until now. In the mean time I upgraded
the app to 2.4 and would like to use EntityProxyId's as method
parameter.
Luckily this time around there is RF validator thingy so I decided to
try once more and just added a client side method to one of my
RequestContexts, similar to;

abstract Request<List<DocumentProxy>> findDocumentsByProject
(EntityProxyId<ProjectProxy> projectId)


I did this without defining the server side counterpart, just to see
what would RF Validator have to say about it.
Validators response was that it can't find service method with
signature I kind of expected to see;

public static List<Document> findDocumentsByProject (Project
projectId)

After that, I implemented adequate service method and all was fine
until I started the app in dev mode. All I got was deferred binding
exception originating from RequestFactoryGenerator. The exception
message was "Invalid request parametrisation" and it just flat-out
refused EntityProxyId<T> as method parameter. Which is quite contrary
to original design goal from 2.1.1 "A service method declared in a
RequestContext can take parameters of EntityProxyId type to avoid the
need to find() an object just to use it as a method parameter"

It seems to me that either I'm "holding it wrong TM" and
EntityProxyId's are to be used in a different way as method
parameters, although it seems not very likely since RF Validator was
ok with it.

It's either that or there is something missing from
com.google.web.bindery.requestfactory.gwt.rebind.model.RequestFactoryModel,
more precisely its validateTransportableType method which throws the
exception when it encounters EntityProxyId.



strcin

unread,
Jan 25, 2012, 4:07:23 AM1/25/12
to Google Web Toolkit
Is there any hope we can have the answer to this question?

On 19 sij, 16:23, strcin <str...@gmail.com> wrote:
> Hello,
>
> What is the correct way of usingEntityProxyId<ProxyType> as a service
> method parameter?
>
>

Ashwin Desikan

unread,
Jan 25, 2012, 4:16:24 AM1/25/12
to google-we...@googlegroups.com
Returning or passing the entity Id to the service method makes sense.

Proxies are going to exist in the client, why do you want to send their Ids to the server?

Thanks
Ashwin
Sent from my iPhone

> --
> 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-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.
>

Thomas Broyer

unread,
Jan 25, 2012, 6:04:55 AM1/25/12
to google-we...@googlegroups.com
It looks like it was never finished: http://code.google.com/p/google-web-toolkit/issues/detail?id=5525

I think most people pass the entity's ID as the argument, rather than its EntityProxyId.
(e;g. 'Request<List<DocumentProxy>> findDocumentsByProject(String projectId);' with 'String getId();' in the ProjectProxy and using as 'ctx.findDocumentsByProject(project.getId())')

Brandon Donnelson

unread,
May 10, 2012, 7:41:52 PM5/10/12
to google-we...@googlegroups.com
It would be nice to send teh EntityProxyId in the service method parameter. I wonder if they finished it?
Reply all
Reply to author
Forward
0 new messages