开发者

GWT Gilead (JPA configuration)

From the Gilead official site:

Note that you still have to properly initialize PersistentBeanManager with associated PersistenceUtil, proxy stor开发者_高级运维e 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);
}

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


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);

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 :

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜