GWT 吉利德(JPA 配置) [英] GWT Gilead (JPA configuration)
问题描述
来自 Gilead 官方网站:
请注意,您仍然需要正确地初始化 PersistentBeanManager关联的 PersistenceUtil,代理存储和可能的类映射器.这必须在任何远程调用之前完成,在远程服务构造函数或继承了init"方法(不要忘记调用 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 吉利德(JPA 配置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!