0

From the Gilead official site:

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

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

kostas trichas
  • 2,923
  • 7
  • 28
  • 37

1 Answers1

2

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

Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
  • Actually Gilead included changes for DataNucleus a long time ago, shortly after GAE/J being released. – DataNucleus Apr 07 '11 at 07:06
  • @DataNucleus: I'm not sure, if you mean this: [http://noon.gilead.free.fr/gilead/index.php?page=adapter4appengine](http://noon.gilead.free.fr/gilead/index.php?page=adapter4appengine) ? ([Source code](http://gilead.svn.sourceforge.net/viewvc/gilead/gilead/tags/gilead-1.3.2/adapter4appengine/src/net/sf/gilead/adapter4appengine/)) – Chris Lercher Apr 07 '11 at 07:55
  • @Chris I gave Bruno all of the necessary information, and he reported having it fully working on his cases, so yes, it ought to be perfectly fine (for earlier versions of DataNucleus) to pass across "detachable" bytecode enhanced classes to GWT. People can obviously pass across non-detachable bytecode enhanced classes to GWT with no problem at all (without Gilead) – DataNucleus Apr 07 '11 at 08:10
  • So do you suggest to change provider, from Hibernate to DataNucleus? – kostas trichas Apr 07 '11 at 10:13
  • @kostas I don't suggest anything. It's your application and you're responsible for your technology choices. I simply point out that DataNucleus also has the ability to be used with GWT with/without Gilead. – DataNucleus Apr 07 '11 at 17:58