0

我正在尝试使用 GWT RF 取回数据,但我遇到了一些麻烦。这是我的工厂、代理和实体。

server.domain 包下的实体:

public class Job implements Serializable {
private int id;
private String announcer;
private String applied;
private String date;
private String description;
private String email;
private String title;
private int version;
static SessionFactory factory;
static ServiceRegistry serviceRegistry;
public Job() {
    try {
        Configuration configuration = new Configuration();
        configuration.configure();
        serviceRegistry = new ServiceRegistryBuilder().applySettings(
        configuration.getProperties()).buildServiceRegistry();
        factory = configuration.buildSessionFactory(serviceRegistry);
    }catch (Throwable ex) {
        System.err.println("Failed to create sessionFactory object." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
//Setters&Getters
public void persist() {
        Session session = factory.openSession();
        Transaction tx = null;
        try {
            tx = session.beginTransaction();
            Job job = this;
            session.save(job);
            tx.commit();
        } catch (HibernateException e) {
            if (tx != null)
                tx.rollback();
            e.printStackTrace();
        } finally {
            session.close();
        }
    }
public static List<Job> findAllJobs() {
        Session session = factory.openSession();
        Transaction tx = null;
        List<Job> list = null;
        try {
            tx = session.beginTransaction();
            Query query = session.createQuery("select * from Job");
            list = query.list();
        } catch (HibernateException e) {
            if (tx != null)
                tx.rollback();
            e.printStackTrace();
        } finally {
            session.close();
        }
        return list;
    }

JobRequest 类文件包含:

Request<List<JobProxy>> findAllJobs();

和入口模块:

final EventBus eventBus = new SimpleEventBus();
JobRequestFactory requestFactory = GWT.create(JobRequestFactory.class);
requestFactory.initialize(eventBus);
JobRequest request = requestFactory.jobRequest();
JobProxy newJob = request.create(JobProxy.class);
requestFactory.jobRequest().findAllJobs().to(new Receiver<List<JobProxy>>(){
public void onSuccess(List<JobProxy> jobs)
{
    System.out.println("SIZE:"+jobs.size());
}
}).fire();

最后我的错误是:

com.google.web.bindery.requestfactory.server.ServiceLayerDecorator die
SEVERE: No RequestContext for operation Lk3VEjMsjGdUyVzlgtz$ggTrjMA=

我不明白为什么会这样……

4

1 回答 1

0

这通常意味着ValidationTool (或注释处理器)没有与最新版本一起运行JobRequestFactoryyour签名(例如接受参数)。JobRequestJobRequestFactoryJobRequestfindAllJobs

于 2012-09-13T12:32:31.770 回答