Hi,
Please see this post:-
viewtopic.php?f=1&t=959557&p=2305817&hilit=implements+HibernateSessionFactory#p2305817Just in case the link does not work, here is the implementation of HibernateSessionFactory
HibernateSessionFactoryImpl :
Code:
public class HibernateSessionFactoryImpl implements HibernateSessionFactory {
static Log log = LogFactory.getLo(HibernateSessionFactoryImpl.class);
static final SessionFactory sessionFactory ;
static {
try {
// Create the SessionFactory
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
log.error("Initial SessionFactory creation failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal threadLocal = new ThreadLocal();
public Session getSession() {
Session s = (Session) threadLocal.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
//Create the Hibernate session
s = sessionFactory.openSession();
//Set the Hibernate session in this Thread ;
threadLocal.set(s);
}
return s;
}
add other methods like closeSession(),beginTransaction, commitTransaction appropriately.
Hope this helps,
Srilatha.