-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Subject says it all.
I couldn't make it work with Hibernate 4 following that docs... It complains about some methods that probably changed between versions...
Right now I'm struggling with ZK + Hibernate trying to find a way for C3P0 pools not to get stuck forever on my SQL server... I'm trying to follow the steps on that documentation with no success... OpenSessionInViewListener seems to be the answer for my problems but I can't make it work with Hibernate 4...
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;
org.zkoss.zkplus.hibernate.HibernateUtil.currentSession(HibernateUtil.java:77)
org.zkoss.zkplus.hibernate.OpenSessionInViewListener.init(OpenSessionInViewListener.java:51)
org.zkoss.zk.ui.util.Configuration.invokeExecutionInits(Configuration.java:876)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:358)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:313)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:214)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:134)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Steps I took:
- Created a brand new ZK Project.
- Copied Hibernate "required" and "c3p0" JARs to WEB-INF/lib.
- Created a basic hibernate.cfg.xml copied from http://books.zkoss.org/wiki/ZK_Developer's_Reference/Integration/Hibernate but just changing the driver to Mysql, no mappings yet...
- Run the project on Eclipse
I have also done a test from hibernate 3 to hibernate 4 and i am getting the same exception:
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;
am having the same problem, the JavaDoc says that the org.hibernate.SessionFactory.getCurrentSession() is deprecated how can i use the new class can anyone provide me an example with ZK + hibernate 4 i just need to see how the sessionFactory is created, since the HibernateUtil class is deprecated.
Thank you!
I have examples, but all maven based. You can check here
Yes / No. You can intregrate ZK with hibernate with spring or without spring also. You can find my examples here for ZK + Hibernate without Spring.
Asked: 2011-12-27 22:49:06 +0800
Seen: 1,010 times
Last updated: Mar 25 '13