Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.LocalSessionFactoryBean


    transactionManager.rollback(transactionStatus);
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // create a FactoryBean to help create a Hibernate SessionFactory
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] {
        new ClassPathResource("Account.hbm.xml", Account.class),
        new ClassPathResource("Beneficiary.hbm.xml", Beneficiary.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.setHibernateProperties(createHibernateProperties());
    // initialize according to the Spring InitializingBean contract
    factoryBean.afterPropertiesSet();
    // get the created session factory
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here


        .getBenefitAvailabilityPolicy());
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // simulate the Spring bean initialization lifecycle
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] { new ClassPathResource("Restaurant.hbm.xml",
        Restaurant.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.afterPropertiesSet();
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b2.getAllocationPercentage());
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // simulate the Spring bean initialization lifecycle
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] {
        new ClassPathResource("Account.hbm.xml", Account.class),
        new ClassPathResource("Beneficiary.hbm.xml", Beneficiary.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.afterPropertiesSet();
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

        .getBenefitAvailabilityPolicy());
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // simulate the Spring bean initialization lifecycle
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] { new ClassPathResource("Restaurant.hbm.xml",
        Restaurant.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.afterPropertiesSet();
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b2.getAllocationPercentage());
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // simulate the Spring bean initialization lifecycle
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] {
        new ClassPathResource("Account.hbm.xml", Account.class),
        new ClassPathResource("Beneficiary.hbm.xml", Beneficiary.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.afterPropertiesSet();
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

  private SessionFactory createTestSessionFactory() throws Exception {
    // create a FactoryBean to help create a Hibernate SessionFactory
   
    //TODO 34: AnnotationSessionFactoryBean
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] {
        new ClassPathResource("Account.hbm.xml", Account.class),
        new ClassPathResource("Beneficiary.hbm.xml", Beneficiary.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.setHibernateProperties(createHibernateProperties());
    // initialize according to the Spring InitializingBean contract
    factoryBean.afterPropertiesSet();
    // get the created session factory
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

    transactionManager.rollback(transactionStatus);
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // create a FactoryBean to help create a Hibernate SessionFactory
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] { new ClassPathResource("Restaurant.hbm.xml",
        Restaurant.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.setHibernateProperties(createHibernateProperties());
    // initialize according to the Spring InitializingBean contract
    factoryBean.afterPropertiesSet();
    // get the created session factory
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

    transactionManager.rollback(transactionStatus);
  }

  private SessionFactory createTestSessionFactory() throws Exception {
    // create a FactoryBean to help create a Hibernate SessionFactory
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(createTestDataSource());
    Resource[] mappingLocations = new ClassPathResource[] {
        new ClassPathResource("Account.hbm.xml", Account.class),
        new ClassPathResource("Beneficiary.hbm.xml", Beneficiary.class) };
    factoryBean.setMappingLocations(mappingLocations);
    factoryBean.setHibernateProperties(createHibernateProperties());
    // initialize according to the Spring InitializingBean contract
    factoryBean.afterPropertiesSet();
    // get the created session factory
    return (SessionFactory) factoryBean.getObject();
  }
View Full Code Here

    public void setUp() throws Exception {
        dataSource = new DriverManagerDataSource("jdbc:h2:mem:hibernate;DB_CLOSE_DELAY=-1", "sa", "sa");

        System.setProperty("hibernate.dialect", H2Dialect.class.getName());
        System.setProperty("hibernate.hbm2ddl.auto", "create-drop");
        AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
        sessionFactory.setDataSource(dataSource);
        sessionFactory.setAnnotatedClasses(new Class[] {PhotoSpot.class});
        sessionFactory.afterPropertiesSet();

        repo.hibernate = new HibernateTemplate(sessionFactory.getObject());
    }
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

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.