Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.LocalSessionFactoryBean


    initializer.setDatabasePopulator(databasePopulator);
    initializer.afterPropertiesSet();
  }

  private SessionFactory getSessionFactory(DataSource dataSource) throws Exception {
    LocalSessionFactoryBean factory = new LocalSessionFactoryBean();
    factory.setDataSource(dataSource);
    factory.setMappingLocations(new Resource[] {
        new ClassPathResource("org/springframework/webflow/persistence/TestBean.hbm.xml"),
        new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml") });
    factory.afterPropertiesSet();
    return factory.getObject();
  }
View Full Code Here


    }
  }

  @SuppressWarnings("cast")
  private SessionFactory getSessionFactory(DataSource dataSource) throws Exception {
    LocalSessionFactoryBean factory = new LocalSessionFactoryBean();
    factory.setDataSource(dataSource);
    factory.setMappingLocations(new Resource[] {
        new ClassPathResource("org/springframework/webflow/persistence/TestBean.hbm.xml"),
        new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml") });
    factory.afterPropertiesSet();
    return (SessionFactory) factory.getObject();
  }
View Full Code Here

        // init SessionFactoryWrapper
        sessionFactoryWrapper = new SessionFactoryWrapper();

        try {
            // init LocalSessionFactoryBean
            localSessionFactoryBean = new LocalSessionFactoryBean();
            localSessionFactoryBean.setDataSource(dataSource);
            localSessionFactoryBean.setHibernateProperties(hibernateProperties);
            localSessionFactoryBean.setPackagesToScan(packagesToScan);

            localSessionFactoryBean.afterPropertiesSet();
View Full Code Here

AbstractGenericDataSourceItemReaderIntegrationTests {

  @Override
  protected ItemReader<Foo> createItemReader() throws Exception {

    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setMappingLocations(new Resource[] { new ClassPathResource("Foo.hbm.xml", getClass()) });
    customizeSessionFactory(factoryBean);
    factoryBean.afterPropertiesSet();

    SessionFactory sessionFactory = factoryBean.getObject();

    HibernatePagingItemReader<Foo> hibernateReader = new HibernatePagingItemReader<Foo>();
    setQuery(hibernateReader);
    hibernateReader.setPageSize(2);
    hibernateReader.setSessionFactory(sessionFactory);
View Full Code Here

  private DataSource dataSource;

  private void initializeItemReader(HibernateCursorItemReader<?> reader,
      String hsqlQuery) throws Exception {

    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setMappingLocations(new Resource[] { new ClassPathResource(
        "Foo.hbm.xml", getClass()) });
    factoryBean.afterPropertiesSet();

    SessionFactory sessionFactory = factoryBean
        .getObject();

    reader.setQueryString(hsqlQuery);
    reader.setSessionFactory(sessionFactory);
    reader.afterPropertiesSet();
View Full Code Here

AbstractGenericDataSourceItemReaderIntegrationTests {

  @Override
  protected ItemReader<Foo> createItemReader() throws Exception {

    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setMappingLocations(new Resource[] { new ClassPathResource("Foo.hbm.xml", getClass()) });
    customizeSessionFactory(factoryBean);
    factoryBean.afterPropertiesSet();

    SessionFactory sessionFactory = factoryBean.getObject();

    HibernateCursorItemReader<Foo> hibernateReader = new HibernateCursorItemReader<Foo>();
    setQuery(hibernateReader);
    hibernateReader.setSessionFactory(sessionFactory);
    hibernateReader.setUseStatelessSession(isUseStatelessSession());
View Full Code Here

  }

  @Before
  public void setUp() throws Exception {

    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setMappingLocations(new Resource[] { new ClassPathResource("../Foo.hbm.xml", getClass()) });
    factoryBean.afterPropertiesSet();

    sessionFactory = factoryBean.getObject();

  }
View Full Code Here

    return reader;
  }

  private SessionFactory createSessionFactory() throws Exception {
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(getDataSource());
    factoryBean.setMappingLocations(new Resource[] { new ClassPathResource("Foo.hbm.xml", getClass()) });
    factoryBean.afterPropertiesSet();

    return factoryBean.getObject();

  }
View Full Code Here

    return dataSource;
  }
 
  @Bean
  public LocalSessionFactoryBean sessionFactory() {
    LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
    sessionFactoryBean.setDataSource(dataSource());
    sessionFactoryBean.setPackagesToScan(env.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    sessionFactoryBean.setHibernateProperties(hibProperties());
    return sessionFactoryBean;
  }
View Full Code Here

     */
    @Bean
    public SessionFactory sessionFactory() throws IOException {
        log.info("SessionFactory Bean을 생성합니다...");

        LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();

        String[] packagenames = getMappedPackageNames();
        if (packagenames != null && packagenames.length > 0) {
            log.debug("hibernate용 entity를 scan합니다. packages=[{}]", arrayToCommaDelimitedString(packagenames));
            factoryBean.setPackagesToScan(packagenames);
        }

        // Naming strategy
        NamingStrategy ns = getNamingStrategy();
        if (ns != null)
            factoryBean.setNamingStrategy(ns);

        // Hibernate properties
        factoryBean.setHibernateProperties(hibernateProperties());
        factoryBean.setDataSource(dataSource());

        Interceptor interceptor = hibernateInterceptor();
        if (interceptor != null)
            factoryBean.setEntityInterceptor(hibernateInterceptor());

        setupSessionFactory(factoryBean);

        factoryBean.afterPropertiesSet();
        log.info("SessionFactory Bean을 생성했습니다!!!");

        return factoryBean.getObject();
    }
View Full Code Here

TOP

Related Classes of org.springframework.orm.hibernate3.LocalSessionFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.