Package org.springframework.orm.hibernate4

Examples of org.springframework.orm.hibernate4.HibernateOperations


        return dataSource;
    }

    @Bean
    public HibernateTransactionManager transactionManager() {
        final HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory().getObject());

        return txManager;
    }
View Full Code Here


    }

    @Bean
    @Autowired
    public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
        final HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory);

        return txManager;
    }
View Full Code Here

      return sessionFactory;
    }

    @Bean
    public HibernateTransactionManager transactionManager( SessionFactory sessionFactory ) {
      return new HibernateTransactionManager( sessionFactory );
    }
View Full Code Here

    return sessionFactory;
  }

  @Bean
  public HibernateTransactionManager transactionManager() {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());
    return txManager;
  }
View Full Code Here

  /* private helper methods */

  @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

    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

TOP

Related Classes of org.springframework.orm.hibernate4.HibernateOperations

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.