I struggle with request factory in gwt. I can make it work with Generics and Polymorphic classes. See here:
RequestFactory client-side inheritance of typed class with generics
Gwt Request Factory. Generics and Inheritance on client side
RequestFactory Entity's parameter: List<OfOtherEntity> is null on client. On server is ok
I think about to switch to restygwt as a transportation layer. This a new app, so there is not much to rewrite. I thought that RF will suit my needs, unfortunatelly I couldn't make it work. So I am thinking about Resty.
Please tell me would it work with generics and polymorphic classes like this below:
@MappedSuperclass
public class GenericModel<T extends GenericModel<T>> implements Identifiable, Versionable {
getId();
getVersion();
}
@MappedSuperclass
public abstract class GenericDictionaryModel<T extends GenericModel<T>> extends GenericModel<T> { getName();
getActive();
}
@Entity class VocabularyDictionaryModel extends GenericDictionaryModel {
someCustomeMethod();
}
public class GenericDao<T extends GenericModel<T>> {
public List<GenericModel<T>> getList() {
return JPA.em().createQuery("FROM " + entityClass.getSimpleName()).getResultList();
}
}
public class GenericDictionaryDao<T extends GenericDictionaryModel<T>> extends GenericDao<T>{
public List<GenericDictionaryModel<T>> getListOrderedByName() {
try {
return JPA.em()
.createQuery("FROM " + entityClass.getSimpleName() + " ORDER BY name")
.getResultList();
} catch (ClassCastException e) {
return new LinkedList<GenericDictionaryModel<T>>();
}
}
}