, , ...
SessionFactoryImplementator sfi = (SessionFactoryImplementator) session.getSessionFactory();
:
SessionFactoryImplementor sfi = (SessionFactoryImplementor) ctx.getBean("sessionFactory");
, Spring, , , Spring3/4 SessionFactoryBean "openSession" .. ( ), , Spring ApplicationContext , " " SessionFactory, Hibernate SessionFactory ( AoP , .)
If you know that there is only one Hibernate SessionFactory in your "appCtx", then an even better way:
appCtx.getBean(org.hibernate.SessionFactory.class);
source
share