SessionFactory()

getSessionFactory().openSession();

今天看到一个用ThreadLocal来存储Session的例子:
在这里插入图片描述里面的s = getSessionFactory().openSession();这句代码不是很理解,查了好多资料都没有找到满意的解答,是不是有个类叫SessionFactory,作为创建session的工厂?还有getSessionFactory()这个方法是干嘛的?还有我发现在Spring和Hibernate框架中都有SessionFactory,请问用法一样吗?怎么使用呢?
本人在校大学生,小白一个,还望请大牛解答一下,谢谢!

猜你喜欢

转载自blog.csdn.net/qq_43221829/article/details/103295845
今日推荐