@Entity class MyBase {...}
@Entity class MyChild1 extends MyBase {...}
@Entity class MyChild2 extends MyBase {...}
...
@ProxyFor(MyBase.class) class MyBaseProxy extends EntityProxy {...}
@ProxyFor(MyChild1.class) class MyChild1Proxy extends MyBaseProxy {...}
@ProxyFor(MyChild2.class) class MyChild2Proxy extends MyBaseProxy {...}
...
@Service(value =MyBaseRequestDao.class, locator = DaoLocator.class)
@ExtraTypes({MyChild1.class,MyChild2.class })
public interface MyBaseRequest extends RequestContext {
Request<MyBaseProxy> getStuff(); // MyChild1 here
}
...
Request<MyBaseProxy> getStuffRequest = request.getStuff();
getStuffRequest.fire(new Receiver<MyBaseProxy>() {
@Override
public void onSuccess(MyBaseProxy proxy) {
if(proxy instanceofMyChild1Proxy)button.setText(((MyChild1Proxy)proxy).getQwerty()); // HERE!
}
});
I'm using Hibernate on the server and in the server (on myMyBaseRequestDao) I can see the correct type of objects. On the client instead the polymorphic mapping seems don't work.
Maybe the problem is the use of locator?
Thanks very much
@Entity class Document {...}
@Entity class CustomerDocument extendsDocument{...}@Entity class CustomerInvoice extendsCustomerDocument{...}@Entity class CustomerCreditNote extendsCustomerDocument{...}@Entity class SupplierDocument extendsDocument{...}@Entity class SupplierInvoice extendsSupplierDocument{...}@Entity classSupplierCreditNote extendsSupplierDocument{...}...
@ProxyFor(Document.class) class DocumentProxy extends EntityProxy {...}
@ProxyFor(CustomerDocument.class) classCustomerDocumentProxy extends DocumentProxy {...}
@ProxyFor(CustomerInvoice.class) classCustomerInvoiceProxy extendsCustomerDocumentProxy{...}
...
@Service(value =CustomerDocumentDao.class, locator = DaoLocator.class)
@ExtraTypes({CustomerInvoice.class,CustomerCreditNote.class })
public interfaceCustomerDocumentRequest extends RequestContext {
Request<CustomerDocumentProxy> getStuff(); //
}
...
Request<CustomerDocumentProxy> getStuffRequest = request.getStuff();
getStuffRequest.fire(new Receiver<CustomerDocumentProxy>() {
@Override
public void onSuccess(CustomerDocumentProxy proxy) {
if(proxy instanceofCustomerInvoiceProxy){ //HERE IS THE PROBLEM!!
}else if(proxy instanceofCustomerInvoiceProxy){}
}enough clear.
});
In this case, I want get the customer's documents on the client. On the server, with Hibernate, I get the list without problem with the correct type of every document.
On the client RF tell me that all entries are of type CustomerDocument insted of concrete class that should be CustomerInvoice or CustomerCreditNote.
I hope that my example is
Thanks