为使ZK和 Hibernate 顺利的工作,你需要完成下面的工作。
在$myApp/WEB-INF/
下创建zk.xml
(如果没有的话)
将下面的内容复制到你的zk.xml
<!-- Hibernate SessionFactory lifecycle --> <listener> <description>Hibernate SessionFactory lifecycle</description> <listener-class>org.zkoss.zkplus.hibernate.HibernateSessionFactoryListener</listener-class> </listener> <!-- Hibernate OpenSessionInView Pattern --> <listener> <description>Hibernate Open Session In View life-cycle</description> <listener-class>org.zkoss.zkplus.hibernate.OpenSessionInViewListener</listener-class> </listener> <!-- Hibernate thread session context handler --> <listener> <description>Hibernate thread session context handler</description> <listener-class>org.zkoss.zkplus.hibernate.HibernateSessionContextListener</listener-class> </listener>