'Configuration()。configure()。buildSessionFactory()'返回一个SessionFactory的对象,它是一个未由​​Configuration类实现的接口?

时间:2013-01-29 12:58:38

标签: java hibernate java-ee sessionfactory

Configuration().configure().buildSessionFactory()如何返回SessionFactory的对象,该对象是Configuration类未实现的接口?

1 个答案:

答案 0 :(得分:0)

Hibernate项目是开源的。欢迎您look为自己。

public SessionFactory buildSessionFactory() throws HibernateException {
    log.debug( "Preparing to build session factory with filters : " + filterDefinitions );
    secondPassCompile();
    validate();
    Environment.verifyProperties( properties );
    Properties copy = new Properties();
    copy.putAll( properties );
    PropertiesHelper.resolvePlaceHolders( copy );
    Settings settings = buildSettings( copy );

    return new SessionFactoryImpl(
            this,
            mapping,
            settings,
            getInitializedEventListeners(),
            sessionFactoryObserver
        );
}