Sunday, June 21, 2015

Re: Can an interface serve as proxy for more than one class in RequestFactory?

Thank you for your reply. It solved the issue.

Now I'm struggling with the editor part. I don't know how to implement the editor so it can work with both classes A and B (where B extends A). I'd like to use a TabPanel and display A in one tab and B in the other one, but I'm having trouble with shared fields. In other words, once B has the same fields as A (plus some others), how can I have two boxes with same name in both tabs? Is there a way to use editor in this scenario?

Once again, thanks for your quick response.

Aldo


On Sun, Jun 21, 2015 at 6:31 PM, Thomas Broyer <t.broyer@gmail.com> wrote:


On Sunday, June 21, 2015 at 9:29:01 PM UTC+2, Aldo wrote:
HI,

I know this is an old thread, but I'm having a similar problem.

I have a class A that is an entity on my server side and a class B that extends A (with PrimaryKeyJoinColumn). So, in other words I have:

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class A {
...
}

@Entity
@PrimaryKeyJoinColumn(name="a_id", referencedColumnName="id")
public class B extends A {
...
}

I already have A extending EntityProxy:

@ProxyFor(A.class)
public interface AProxy extends EntityProxy {
...
}

And now I need to map B as an Entity Proxy as well, but I'm getting an exception. What I did is:

@ProxyFor(B.class)
public interface BProxy extends AProxy, EntityProxy {
...
}

but I get the following exception:
BProxy is not an EntityProxy type
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.asEntityProxy(IdFactory.java:66)


Is it possible to do what I'm trying here? If so, how?

Assuming you get that error on the client side, it actually means that your RequestFactory doesn't know about BProxy.
BProxy has to be referenced from a RequestContext or another EntityProxy/ValueProxy transitively referenced from your RequestFactory interface.
You might have to annotate one of your RequestContext or proxy with @ExtraTypes(BProxy.class).

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment