public final class SessionFactoryManager extends Object implements net.matrix.lang.Resettable
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_NAME
默认的 SessionFactory 名称。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clearAll()
清除所有 SessionFactory 配置。
|
org.hibernate.Session |
createSession()
使用 SessionFactory 建立 Session。
|
void |
dropTransactionContext()
丢弃顶层事务上下文。
|
org.hibernate.cfg.Configuration |
getConfiguration()
获取 SessionFactory 配置。
|
ConnectionInfo |
getConnectionInfo()
获取 SessionFactory 相关连接信息。
|
static SessionFactoryManager |
getInstance() |
static SessionFactoryManager |
getInstance(String name) |
org.hibernate.service.ServiceRegistry |
getServiceRegistry()
获取 ServiceRegistry。
|
org.hibernate.SessionFactory |
getSessionFactory()
获取 SessionFactory。
|
HibernateTransactionContext |
getTransactionContext()
获取当前顶层事务上下文,没有则建立。
|
static boolean |
isNameUsed(String name)
判断 SessionFactory 名称是否已被占用。
|
static void |
nameSessionFactory(String name)
命名默认配置文件到指定名称。
|
static void |
nameSessionFactory(String name,
String configResource)
命名一个配置文件到指定名称。
|
void |
reset()
关闭 SessionFactory。
|
static void |
resetAll()
重置所有 SessionFactory 配置。
|
public static SessionFactoryManager getInstance()
public static SessionFactoryManager getInstance(String name)
name - SessionFactory 名称IllegalStateException - 还未命名实例public static boolean isNameUsed(String name)
name - SessionFactory 名称public static void nameSessionFactory(String name)
name - SessionFactory 名称IllegalStateException - 名称已被占用public static void nameSessionFactory(String name, String configResource)
name - SessionFactory 名称configResource - SessionFactory 配置资源IllegalStateException - 名称已被占用public static void clearAll()
public static void resetAll()
public void reset()
reset 在接口中 net.matrix.lang.ResettableResettable.reset()public org.hibernate.cfg.Configuration getConfiguration()
throws SQLException
SQLExceptionpublic org.hibernate.service.ServiceRegistry getServiceRegistry()
throws SQLException
SQLExceptionpublic org.hibernate.SessionFactory getSessionFactory()
throws SQLException
SQLExceptionpublic org.hibernate.Session createSession()
throws SQLException
SQLException - 建立失败public HibernateTransactionContext getTransactionContext()
public void dropTransactionContext()
throws SQLException
SQLException - 回滚发生错误public ConnectionInfo getConnectionInfo() throws SQLException
SQLException - 信息获取失败Copyright © 2008–2014 Matrix. All rights reserved.