org.zkoss.zkplus.hibernate
Class HibernateUtil

java.lang.Object
  extended by org.zkoss.zkplus.hibernate.HibernateUtil

Deprecated. As of release 6.0.2, please use the official Hibernate's method instead.

public class HibernateUtil
extends java.lang.Object

Utility to access Hibernate Session. This implementation works with the Hibernate's thread session context (version 3.1+). That is, you have to specified hibernate's configuration file "hibernate.cfg.xml" to as follows:


  <session-factory>
                ...
                <property name="current_session_context_class">thread</property>
  </session-factory>
 

 

Since ZK 3.0.1, if your hibernate configuration file name is not the default "hibernate.cfg.xml", you can specify it in WEB-INF/zk.xml. Just add following lines:


        <preference>
        <name>HibernateUtil.config</name>
        <value>YOUR-HIBERNATE-FILENAME</value>
 

Also notice that the zkplus.jar must be put under application's WEB-INF/lib because the SessionFactory is stored as a class static member.

Applicable to Hibernate version 3.2.ga or later

Author:
henrichen

Field Summary
static java.lang.String CONFIG
          Deprecated. A preference or a library property used to configure HibernateUtil.
 
Constructor Summary
HibernateUtil()
          Deprecated.  
 
Method Summary
static void closeSession()
          Deprecated. Wrapping HibernateUtil.getSessionFactory().getCurrentSession().close() into a simple API.
static org.hibernate.Session currentSession()
          Deprecated. Wrapping HibernateUtil.getSessionFactory().getCurrentSession() into a simple API.
static org.hibernate.SessionFactory getSessionFactory()
          Deprecated. Get the singleton hibernate Session Factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG

public static final java.lang.String CONFIG
Deprecated. 
A preference or a library property used to configure HibernateUtil. It first looks up Configuration.getPreference(java.lang.String, java.lang.String), and then Library.getProperty(java.lang.String). Ignored if none of them is specified.

See Also:
Constant Field Values
Constructor Detail

HibernateUtil

public HibernateUtil()
Deprecated. 
Method Detail

getSessionFactory

public static org.hibernate.SessionFactory getSessionFactory()
Deprecated. 
Get the singleton hibernate Session Factory.


currentSession

public static org.hibernate.Session currentSession()
                                            throws org.hibernate.HibernateException
Deprecated. 
Wrapping HibernateUtil.getSessionFactory().getCurrentSession() into a simple API.

Throws:
org.hibernate.HibernateException

closeSession

public static void closeSession()
                         throws org.hibernate.HibernateException
Deprecated. 
Wrapping HibernateUtil.getSessionFactory().getCurrentSession().close() into a simple API.

Throws:
org.hibernate.HibernateException


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo