public class HibernateSessionMgr extends AbstractSessionMgr<org.hibernate.Session>
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_CONFIG_FILE
默认 Hibernate 配置文件
|
configFile, defaultTransIsoLevel, localSession| 构造器和说明 |
|---|
HibernateSessionMgr() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
beginTransaction()
开始新事务
|
protected org.hibernate.SessionFactory |
buildSessionFactory() |
void |
closeSession()
关闭当前线程的
Session 实例 |
void |
commit()
提交事务
|
String |
getConfigFile()
获取配置文件
|
org.hibernate.Session |
getSession()
获取绑定到当前线程的
Session 实例 |
org.hibernate.SessionFactory |
getSessionFactory()
获取当前的
SessionFactory 实例 |
org.hibernate.Transaction |
getTransaction()
获取的
Session 对应的 Transaction 实例 |
void |
initialize()
使用默认的 Hibernate 配置文件配置
SessionFactory |
void |
initialize(String... args)
初始化
|
void |
initialize(String hbn_cfg_file)
使用特定的 Hibernate 配置文件配置
SessionFactory |
void |
initialize(String hbn_cfg_file,
String packages)
使用特定的 Hibernate 配置文件配置
SessionFactory,并自动扫描特定包下的实体对象 |
protected void |
loadDefalutTransIsoLevel()
|
void |
rollback()
回滚事务
|
void |
setSessionTransIsoLevel(TransIsoLevel level)
|
void |
unInitialize()
关闭
SessionFactory |
currentSession, getDefalutTransIsoLevel, isInvoking, setInvokingpublic void initialize(String... args)
args - DEFAULT_CONFIG_FILE) InvalidParameterExceptionorg.hibernate.HibernateExceptionpublic void initialize()
SessionFactoryorg.hibernate.HibernateException - : 配置失败时抛出该异常public void initialize(String hbn_cfg_file)
SessionFactoryhbn_cfg_file - : 配置文件路径org.hibernate.HibernateException - : 配置失败时抛出该异常public void initialize(String hbn_cfg_file, String packages)
SessionFactory,并自动扫描特定包下的实体对象hbn_cfg_file - : 配置文件路径packages - : 实体对象基包org.hibernate.HibernateException - : 配置失败时抛出该异常public void unInitialize()
SessionFactoryunInitialize 在接口中 SessionMgr<org.hibernate.Session>unInitialize 在类中 AbstractSessionMgr<org.hibernate.Session>org.hibernate.HibernateException - : 操作失败时抛出该异常protected void loadDefalutTransIsoLevel()
loadDefalutTransIsoLevel 在类中 AbstractSessionMgr<org.hibernate.Session>public void setSessionTransIsoLevel(TransIsoLevel level)
public String getConfigFile()
getConfigFile 在接口中 SessionMgr<org.hibernate.Session>getConfigFile 在类中 AbstractSessionMgr<org.hibernate.Session>public final org.hibernate.SessionFactory getSessionFactory()
SessionFactory 实例public final org.hibernate.Session getSession()
Session 实例org.hibernate.HibernateException - : 获取 Session 实例失败时抛出该异常protected org.hibernate.SessionFactory buildSessionFactory()
public final void closeSession()
Session 实例public final org.hibernate.Transaction getTransaction()
Session 对应的 Transaction 实例public final void beginTransaction()
public final void commit()
public final void rollback()
Copyright © 2015 JessMA Open Source. All rights reserved.