Configuration 配置
configure()
configure(String resource)
addResource(String resource) 导入一个指定位置的映射文件
addClass(Class clazz) 导入与指定类同一个包中的以类名为前缀,后缀为.hbm.xml的映射文件
buildSessionFactory()
SessionFactory Session工厂
openSession()
getCurrentSession()
close()
Session 很重要的一个对象
操作对象的方法
save(Object)
update(Object)
delete(Object)
查询的方法
createQuery(String) --> Query
createCriteria(Class)
管理事务的方法
beginTransaction() --> Transaction
getTransaction() --> Transaction 获取当前Session中关联的事务对象
其他的方法
...
Transaction 事务
commit()
rollback()
Query 查询
list() 查询一个结果集合。
uniqueResult() 查询一个唯一的结果,如果没有结果,则返回null,如果结果有多个,就抛异常。
...
configure()
configure(String resource)
addResource(String resource) 导入一个指定位置的映射文件
addClass(Class clazz) 导入与指定类同一个包中的以类名为前缀,后缀为.hbm.xml的映射文件
buildSessionFactory()
SessionFactory Session工厂
openSession()
getCurrentSession()
close()
Session 很重要的一个对象
操作对象的方法
save(Object)
update(Object)
delete(Object)
查询的方法
createQuery(String) --> Query
createCriteria(Class)
管理事务的方法
beginTransaction() --> Transaction
getTransaction() --> Transaction 获取当前Session中关联的事务对象
其他的方法
...
Transaction 事务
commit()
rollback()
Query 查询
list() 查询一个结果集合。
uniqueResult() 查询一个唯一的结果,如果没有结果,则返回null,如果结果有多个,就抛异常。
...