GWT Gilead(JPA配置) [英] GWT Gilead (JPA configuration)

查看:88
本文介绍了GWT Gilead(JPA配置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 Gilead 官方网站:


请注意,您仍然必须使用
关联PersistenceUtil,代理
store以及可能的类映射器来正确初始化PersistentBeanManager。这个
必须在任何远程调用之前完成,在Remote Service构造函数中
或在
中继承init方法(不要忘记
来调用super.init()!):

Note that you still have to properly initialize PersistentBeanManager with associated PersistenceUtil, proxy store and possibly class mapper. This must be done before any remote call, in Remote Service constructor or in inherited "init" method (do not forget to call super.init() !):



public UserRemoteImpl()
{
HibernateUtil hibernateUtil = new HibernateUtil(MyApplicationHibernateUtil.getSessionFactory());

PersistentBeanManager persistentBeanManager = GwtConfigurationHelper.initGwtStatelessBeanManaer(hibernateUtil);

setBeanManager(persistentBeanManager);
}

我使用 JPA ,我必须做一些不同的事情吗?

I Use JPA, do i have to do something different?

推荐答案

如果您在Hibernate中使用JPA,可以使用 HibernateJpaUtil 像这样:

If you're using JPA with Hibernate, you can use HibernateJpaUtil like this:

String PERSISTENCE_UNIT_NAME = "...";
EntityManagerFactory emf = 
    Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);

HibernateJpaUtil hibernateJpaUtil = new HibernateJpaUtil();
hibernateJpaUtil.setEntityManagerFactory(emf);

PersistentBeanManager persistentBeanManager =
    GwtConfigurationHelper.initGwtStatelessBeanManager(hibernateJpaUtil);

setBeanManager(persistentBeanManager);

如果您将JPA与另一个实现比Hibernate一起使用,您可能目前运气不佳 - 或者你必须自己实现 IPersistenceUtil

If you're using JPA with another implementation than Hibernate, you're probably currently out of luck - or you'd have to implement IPersistenceUtil yourself.

http://noon.gilead.free.fr/gilead/index.php?page=overview


即使Hibernate是目前支持的唯一一个,OpenJPA和EclipseLink支持也是计划中的

even if Hibernate is the only one currently supported, OpenJPA and EclipseLink supports is planned

这篇关于GWT Gilead(JPA配置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆