GWT-PアプリケーションでHibernateのEntityManager
を使用しようとしています。GWT-P + JPA Hibernate EntityManager
org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider
(あなたはこの1のための提案を持っていない限り)だから私は他のアプローチをしようとしている:私はそれがClassCastException
を引き起こし提案PersistFilter
public class MyModule extends ServletModule {
protected void configureServlets() {
install(new JpaPersistModule("myJpaUnit")); // like we saw earlier.
filter("/*").through(PersistFilter.class);
}
}
を使用することはできませんように
残念ながら、それが見えます。
私は仕事に最初のサービスを得るためにかなり接近していなければならないが、注入されたEntityManager
はいつも私は、セットアップ中にミスをした疑いがあるnull
public class ImageMetaDataService {
@Inject EntityManager em;
@Transactional
public void createNewImageMetaData(ImageMetaDataImpl imd) {
em.persist(imd);
}
}
です。
public class MyGuiceServletContextListener extends GuiceServletContextListener {
@Override
protected Injector getInjector() {
return Guice.createInjector(new ServerModule(), new DispatchServletModule(), new JpaPersistModule("name"));
}
}
そして最後に私の最も重要な質問:どのように私はJPAを開始する。このようJpaPersistModule
を追加対(DispatchServletModule
中)install(new JpaPersistModule("name"));
を使用しての違いがあります。ドキュメントは、次のようにクラスをお勧め:
public class MyInitializer {
@Inject MyInitializer(PersistService service) {
service.start();
// At this point JPA is started and ready.
}
}
しかし、私は(GWT-Pで)それを行う方法が表示されません。
あなたは解決策を見つけましたか? –