配置ZK的配置文件

为使ZK和 Hibernate 顺利的工作,你需要完成下面的工作。

  1. $myApp/WEB-INF/下创建zk.xml (如果没有的话)

  2. 将下面的内容复制到你的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>