Package org.springframework.orm.hibernate4

Examples of org.springframework.orm.hibernate4.HibernateTransactionManagerTests


        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

    hibernateProperties.put("hibernate.hbm2ddl.auto", "create-drop");
    hibernateProperties.put("hibernate.show_sql", "true");
    hibernateProperties.put("hibernate.format_sql", "true");
    hibernateProperties.put("jadira.usertype.currencyCode", "BRL");

    final LocalSessionFactoryBuilder sfBuilder = new LocalSessionFactoryBuilder(
        dataSource);

    sfBuilder.addProperties(hibernateProperties);

    return sfBuilder.scanPackages(User.class.getPackage()
        .getName());
  }
View Full Code Here

        Map<String, String> propsMap = p;

        for (String k : propsMap.keySet())
            props.setProperty(k, propsMap.get(k));

        return new LocalSessionFactoryBuilder(dataSource())
            .addAnnotatedClasses(Customer.class)
            .addProperties(props)
            .buildSessionFactory();
    }
View Full Code Here

        "dateTime");

    final String modelPackage = User.class.getPackage()
        .getName();

    final LocalSessionFactoryBuilder sfBuilder = new LocalSessionFactoryBuilder(
        dataSource);

    sfBuilder.addProperties(hibernateProperties);

    return sfBuilder.scanPackages(modelPackage)
        .buildSessionFactory();
  }
View Full Code Here

    }

    @Autowired
    @Bean(name = "sessionFactory")
    public SessionFactory getSessionFactory(BasicDataSource dataSource) {
        LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
        sessionBuilder.addAnnotatedClasses(Book.class);
        sessionBuilder.addProperties(getHibernateProperties());
        return sessionBuilder.buildSessionFactory();
    }
View Full Code Here

    }

    @Autowired
    @Bean(name = "sessionFactory")
    public SessionFactory getSessionFactory(BasicDataSource dataSource) {
        LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
        sessionBuilder.addAnnotatedClasses(Book.class);
        sessionBuilder.addProperties(getHibernateProperties());
        return sessionBuilder.buildSessionFactory();
    }
View Full Code Here

TOP

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

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.