sessionfactoryprovider.java
来自「The ability to create groups of reports,」· Java 代码 · 共 44 行
JAVA
44 行
package org.efs.openreports.providers.persistence;
import com.opensymphony.xwork.interceptor.component.Disposable;
import org.apache.log4j.Logger;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;
public class SessionFactoryProvider implements Disposable
{
protected static Logger log =
Logger.getLogger(SessionFactoryProvider.class.getName());
private SessionFactory sessionFactory;
public SessionFactoryProvider() throws Exception
{
sessionFactory = new Configuration().configure().buildSessionFactory();
log.info("SessionFactoryProvider Created.");
}
public SessionFactory getSessionFactory()
{
return sessionFactory;
}
public void dispose()
{
try
{
sessionFactory.close();
log.info("SessionFactory closed.");
}
catch(HibernateException he)
{
log.warn(he.toString());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?