Hi,
I am trying to use RequestFactory with http://hades.synyx.org for services
on server side.
All CRUD method are implemented in GenericDao<?, ?> interface so I don't
need to repeat them.
Ugly code for service locator:
public class RamusServiceLocator implements ServiceLocator {
Logger logger = LoggerFactory.getLogger(RamusServiceLocator.class);
@SuppressWarnings("unchecked")
@Override
public Object getInstance(Class<?> clazz) {
if (!org.synyx.hades.dao.GenericDao.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException();
}
Class<GenericDao<?, ?>> castClazz = null;
try {
castClazz = (Class<GenericDao<?, ?>>) Class
.forName(clazz.getName());
} catch (ClassNotFoundException e) {
logger.error("Could not load service.", e);
}
EntityManager em = EMF.get().createEntityManager();
em.getTransaction().begin();
GenericDaoFactory factory = GenericDaoFactory.create(em);
return factory.getDao(castClazz);
}
}
Service:
public interface CurrencyDao extends GenericDao<Currency, Long> {
}
Request:
@Service(value = CurrencyDao.class, locator = RamusServiceLocator.class)
public interface CurrencyRequest extends RequestContext {
Request<Long> count();
}
This code results in such error:
SEVERE: Method overloads found in type server.service.CurrencyDao named
count:
java.lang.Long count(org.synyx.hades.domain.Specification )
java.lang.Long count()
In http://code.google.com/webtoolkit/doc/trunk/DevGuideRequestFactory.html
isn't
mentioned such restriction.
How to overcome this problem? Suggestions on design decisions also
are welcome.
Ābele
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.