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

130 zobrazení
Přeskočit na první nepřečtenou zprávu

Matthew Hill

nepřečteno,
27. 12. 2010 20:27:0527.12.10
komu: 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

nepřečteno,
27. 12. 2010 20:52:5427.12.10
komu: 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

nepřečteno,
27. 12. 2010 20:59:2327.12.10
komu: 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

nepřečteno,
27. 12. 2010 21:05:1727.12.10
komu: 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();

Zpráva byla smazána

zixzigma

nepřečteno,
27. 12. 2010 21:17:1327.12.10
komu: 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

nepřečteno,
27. 12. 2010 22:15:0327.12.10
komu: 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

nepřečteno,
27. 12. 2010 22:25:4727.12.10
komu: google-we...@googlegroups.com
I've got it now. I just need to add it to the interface.
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv