<commit_before>package example.domain.services;

import com.dbdeploy.DbDeploy;
import example.domain.services.hibernate.DbDeployer;
import org.hibernate.SessionFactory;
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.aop.interceptor.PerformanceMonitorInterceptor;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;

import javax.sql.DataSource;
import java.util.Properties;

import static example.utils.Strings.array;

@Configuration
public class ServicesConfiguration {

    @Autowired Environment env;
    @Value("/WEB-INF/deltas") Resource deltasDir;
    @Value("/WEB-INF/create_changelog.sql") Resource createSql;

    @Bean
    public HibernateOperations hibernateOperations() throws Exception {
        return new HibernateTemplate(sessionFactory().getObject());
    }

    @Bean
    public FactoryBean<SessionFactory> sessionFactory() {
        LocalSessionFactoryBean factory = new LocalSessionFactoryBean();
        factory.setMappingResources(array("example/domain/services/hibernate/Document.hbm.xml"));
        factory.setHibernateProperties(hibernateProperties());<commit_msg>no need to access the factory directly, let spring do its thing<commit_after>package example.domain.services;

import com.dbdeploy.DbDeploy;
import example.domain.services.hibernate.DbDeployer;
import org.hibernate.SessionFactory;
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.aop.interceptor.PerformanceMonitorInterceptor;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;

import javax.sql.DataSource;
import java.util.Properties;

import static example.utils.Strings.array;

@Configuration
public class ServicesConfiguration {

    @Autowired Environment env;
    @Value("/WEB-INF/deltas") Resource deltasDir;
    @Value("/WEB-INF/create_changelog.sql") Resource createSql;

    @Bean
    public HibernateOperations hibernateOperations(SessionFactory sessionFactory) throws Exception {
        return new HibernateTemplate(sessionFactory);
    }

    @Bean
    public FactoryBean<SessionFactory> sessionFactory() {
        LocalSessionFactoryBean factory = new LocalSessionFactoryBean();
        factory.setMappingResources(array("example/domain/services/hibernate/Document.hbm.xml"));
        factory.setHibernateProperties(hibernateProperties());
{'fraction_non_alphanumeric': 0.09025367156208278, 'fraction_numerical': 0.0016021361815754338, 'mean_word_length': 6.374015748031496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2496349', 'n_tokens_mistral': 995, 'n_tokens_neox': 946, 'n_words': 165}