In this method i used SessionFactory.openSession()
to get hibernate Session
:
public static Session getSession() {
Session session = null;
if (factory == null) {
session = initSessionFactory().openSession(); //initSessionFactory() returns SessionFactory object.
} else {
session = factory.openSession();
}
return session;
}
since, the method SessionFactory#openSession()
throws HibernateException
, then why doesn't my method throw an Exception, why there is not any CompileTime Error?