SessionFactory()

getSessionFactory().openSession();

Today I saw an example of using ThreadLocal to store Session:
insert image description hereinside s = getSessionFactory().openSession(); this code is not very understandable, and I have checked a lot of information but have not found a satisfactory answer. Is there a class called SessionFactory? As a factory for creating sessions? And what is the getSessionFactory() method for? Also, I found that both Spring and Hibernate frameworks have SessionFactory. Is the usage the same? How to use it?
I am a college student, and I am a rookie. I hope Daniel can answer it, thank you!

Guess you like

Origin blog.csdn.net/qq_43221829/article/details/103295845