Why doesn't LocalSessionFactoryBean implement getCurrentSession, meanwhile the instance of SessionFactory can invoke the method?
问题 This is my configuration for Spring Bean: <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> And then I use it in DAO layer like this: @Resource(name = "sessionFactory") private SessionFactory sessionFactory; At last it's where my question come from: public T getById(int id) { Session session = sessionFactory.getCurrentSession(); return (T) session.get(clz, id); } In all, my question is that: In class "org.springframework.orm.hibernate4