Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.LocalSessionFactoryBean


    }

    @Bean
    public SessionFactory sessionFactory() throws IOException {

        LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
        factoryBean.setPackagesToScan(getMappedPackageNames());
        factoryBean.setDataSource(dataSource());
        factoryBean.setHibernateProperties(hibernateProperties());

        factoryBean.afterPropertiesSet();

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


    dataSource.setPassword("");
    dataSource.setDefaultAutoCommit(false);
    dataSource.setFilters("log4j");

    /*init sessionFactory*/
    LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
    factoryBean.setDataSource(dataSource);

    Properties prop = new Properties();
    prop.put("hibernate.show_sql", "true");
    //prop.put("hibernate.format_sql", "true");
    prop.put("hibernate.hbm2ddl.auto", "create");
    prop.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    factoryBean.setHibernateProperties(prop);
    factoryBean.setAnnotatedClasses(new Class<?>[]{Sample.class});

    try {
      factoryBean.afterPropertiesSet();
    } catch (IOException e) {
      e.printStackTrace();
    }
    sessionFactory = factoryBean.getObject();
  }
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause1.persistence.model" });
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setHibernateProperties(hibernateProperties());

        // sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause2.persistence.model" });
        sessionFactory.setAnnotatedClasses(new Class[] { Foo.class });

        return sessionFactory;
    }
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setHibernateProperties(hibernateProperties());

        // sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause2.persistence.model" });
        // sessionFactory.setAnnotatedClasses(new Class[] { Foo.class });

        return sessionFactory;
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setPackagesToScan(new String[] { "org.baeldung.spring.persistence.model" });
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }
View Full Code Here

        super();
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() {
        final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(restDataSource());
        sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }
View Full Code Here

      return dataSource;
    }

    @Bean
    public LocalSessionFactoryBean sessionFactory() throws Exception {
      LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
      sessionFactory.setDataSource( dataSource() );
      sessionFactory.setPackagesToScan( "com.foreach.across.test.modules.hibernate1",
                                        "com.foreach.across.test.modules.hibernate2" );

      Properties p = new Properties();
      p.setProperty( "hibernate.hbm2ddl.auto", "create-drop" );

      sessionFactory.setHibernateProperties( p );

      return sessionFactory;
    }
View Full Code Here

    return new PropertySourcesPlaceholderConfigurer();
  }

  @Bean
  public LocalSessionFactoryBean sessionFactory() {
    final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
    sessionFactory.setDataSource(dataSource());
    sessionFactory.setPackagesToScan("ua.ck.geekhub.entity");
    sessionFactory.setHibernateProperties( hibernateProperties );
    return sessionFactory;
  }
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.