ThreadLocalSessionContext currentSession()

获得Session current
从本地线程中get,为null,返回null,
不为空,get(factory) //SessionFatoryImplementor factory
//factory在构造函数中赋值
if(current==null)
重新通过factory创建一个Session赋给current openSession(
连接为null,
允许自动刷新先与事务完成为true,
在事务完成后自动关闭 true,
管理jdbc的模式为 connectionReleaseMode)
给current注册个同步的事务通过factory
每次做完后从本地线程中移除facotry

如果需要织入
创建保护织入的事务wrapper
创建新的代理实例
将实例加入wrapper
返回实例

在map中加入current(绑定)key为factory
返回current

你可能感兴趣的:(jdbc)