Type mismatch: cannot convert from Request<capture#1-of ?> to Request<EmployeeProxy>

159 views
Skip to first unread message

Matthew Hill

unread,
Dec 27, 2010, 8:27:05 PM12/27/10
to google-we...@googlegroups.com
The following line of code throws the above error:

Request<EmployeeProxy> request = requestFactory.find(employee.stableId());


employee is just an EmployeeProxy instance.


What's wrong?

zixzigma

unread,
Dec 27, 2010, 8:52:54 PM12/27/10
to Google Web Toolkit

it might be that you need to get the employeeRequest first, before
invoking find on it

requestFactory.employeeRequest().find(xxxx).fire

Matthew Hill

unread,
Dec 27, 2010, 8:59:23 PM12/27/10
to google-we...@googlegroups.com
I'm going to try using my own find method on employeeRequest, like you said.

Request<EmployeeProxy> request = requestFactory.employeeRequest().findEmployee(employee.getId());


Not quite sure what all of this stableId stuff is. Anyone care to explain? 

Thomas Broyer

unread,
Dec 27, 2010, 9:05:17 PM12/27/10
to google-we...@googlegroups.com
Nothing's wrong (apart from generics in Java, once again).

Have a look at the JavaDoc for stableId:
Subtypes should override to declare they return a stable id of their own type, to allow type safe use of the request objects returned by RequestFactory.find(EntityProxyId).

In other words, either you type-cast and add a @SuppressWarnings("unchecked"), or (better) you re-define stableId in each of your EntityProxy that you intend to use with RequestFactory#find, e.g.:
  EntityProxyId<EmployeeProxy> stableId();

Message has been deleted

zixzigma

unread,
Dec 27, 2010, 9:17:13 PM12/27/10
to Google Web Toolkit
is it enough to just declare the stableId property
or we also need to provide implementation ?


and one question about Version.
does RequestFactory depend on version property ?
who generates the version number ?
is it the RequestFactory that does it? everytime a proxy changes
value ?

Matthew Hill

unread,
Dec 27, 2010, 10:15:03 PM12/27/10
to google-we...@googlegroups.com
Right. So from the overridden stableId method I return the unique ID which I'm using for my persistence?

And then what happens when you call RequestFactory#Find? How does it 'find' the proxy?

Matthew Hill

unread,
Dec 27, 2010, 10:25:47 PM12/27/10
to google-we...@googlegroups.com
I've got it now. I just need to add it to the interface.
Reply all
Reply to author
Forward
0 new messages