你能告诉我我的问题是什么吗?我有 GWT RequestContext ,其中包含一些方法和一些具有该方法实现的服务类。当我在开发模式下运行时,我的 RequestContext 对象没有通过验证。
这是 RequestContext 接口:
@Service(value = CorporateAccountService.class, locator = CorporateAccountServiceLocator.class)
public interface CorporateAccountServiceRequest extends RequestContext {
Request<List<CorporateAccountProxy>> findAllCorporateAccounts();
Request<CorporateAccountProxy> findCorporateAccount(Long id);
InstanceRequest<CorporateAccountProxy, Void> persist();
InstanceRequest<CorporateAccountProxy, Void> remove();
}
这是ServiceLocator指定的实现:
public class CorporateAccountService {
public void persist(CorporateAccount corporateAccount) {
EntityManager em = EMF.get().createEntityManager();
try {
em.persist(corporateAccount);
} finally {
em.close();
}
}
public void remove(CorporateAccount corporateAccount) {
EntityManager em = EMF.get().createEntityManager();
try {
CorporateAccount attached = em.find(CorporateAccount.class,
corporateAccount.getId());
em.remove(attached);
} finally {
em.close();
}
}
@SuppressWarnings("unchecked")
public List<CorporateAccount> findAllCorporateAccounts() {
EntityManager em = EMF.get().createEntityManager();
try {
List<CorporateAccount> list = em.createQuery(
"FROM CorporateAccount").getResultList();
// force to get all the employees
list.size();
return list;
} finally {
em.close();
}
}
public CorporateAccount findCorporateAccount(Long id) {
EntityManager em = EMF.get().createEntityManager();
try {
return em.find(CorporateAccount.class, id);
} finally {
em.close();
}
}
}
我收到有关请求上下文验证的错误:
Jun 9, 2011 7:32:10 PM com.dms.admin.shared.CorporateAccountServiceRequest com.google.web.bindery.requestfactory.shared.InstanceRequest remove()
SEVERE: Could not find matching method in com.dms.admin.server.CorporateAccountService.
Possible matches:
void remove(com.dms.admin.server.domain.CorporateAccount )
Jun 9, 2011 7:32:10 PM com.dms.admin.shared.CorporateAccountServiceRequest com.google.web.bindery.requestfactory.shared.InstanceRequest persist()
SEVERE: Could not find matching method in com.dms.admin.server.CorporateAccountService.
Possible matches:
void persist(com.dms.admin.server.domain.CorporateAccount )
Jun 9, 2011 7:32:10 PM com.google.web.bindery.requestfactory.server.ServiceLayerDecorator die
SEVERE: The RequestContext type com.dms.admin.shared.CorporateAccountServiceRequest did not pass validation
Jun 9, 2011 7:32:10 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
SEVERE: Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type com.dms.admin.shared.CorporateAccountServiceRequest did not pass validation
我的 RequestContext 中定义的 persist(CorporateAccount corpAcc) 和 remove(CorporateAccount corpAcc) 方法存在一些问题,但我正在实现它们。
预先感谢您,感谢您的帮助。