List of usage examples for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter HibernateJpaVendorAdapter
@SuppressWarnings("deprecation") public HibernateJpaVendorAdapter()
From source file:config.persistence.VendorAdapterConfig.java
@Profile("development") @Bean(name = "jpaVendorAdapter") public JpaVendorAdapter provideJpaVendorAdapterDev() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setDatabase(Database.DERBY); adapter.setShowSql(env.getProperty("hibernate.dev.show_sql", Boolean.class)); adapter.setGenerateDdl(env.getProperty("hibernate.dev.hbm2ddl.auto", Boolean.class)); adapter.setDatabasePlatform(env.getProperty("hibernate.dev.dialect")); return adapter; }
From source file:br.com.alura.casadocodigo.conf.JPAConfiguration.java
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); JpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); factoryBean.setJpaVendorAdapter(adapter); DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setUsername("root"); dataSource.setPassword(""); dataSource.setUrl("jdbc:mysql://localhost:3306/casadocodigo"); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); factoryBean.setDataSource(dataSource); Properties properties = new Properties(); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); properties.setProperty("hibernate.show_sql", "true"); properties.setProperty("hibernate.hbm2ddl.auto", "update"); factoryBean.setJpaProperties(properties); factoryBean.setPackagesToScan("br.com.alura.casadocodigo.models"); return factoryBean; }
From source file:br.com.projetotcc.conf.JPAConfiguration.java
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource());/*from w ww . j a v a2s . c o m*/ em.setPackagesToScan(new String[] { "br.com.projetotcc.model" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
From source file:ua.biglib.salivon.BookConfig.java
private JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); jpaVendorAdapter.setShowSql(true);/* w w w. j a v a2s .c o m*/ jpaVendorAdapter.setGenerateDdl(true); jpaVendorAdapter.setDatabasePlatform(DerbyTenSevenDialect.class.getName()); return jpaVendorAdapter; }
From source file:com.iopr.PersistenceJPAConfig.java
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource());//from ww w. j a v a2 s .c o m em.setPackagesToScan(new String[] { "com.iopr.model" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
From source file:com.example.spring.boot.app.RepositoryConfig.java
@Bean public EntityManagerFactory entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setGenerateDdl(true);//from w w w. ja v a 2s .co m LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan(User.class.getPackage().getName()); factory.setDataSource(dataSource()); factory.afterPropertiesSet(); return factory.getObject(); }
From source file:com.sapito.db.config.PersistenceConfig.java
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource());/*from ww w . j ava2s . c o m*/ em.setPackagesToScan(new String[] { "com.sapito.db.entities" }); JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(jpaVendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
From source file:org.hellospring4.config.PersistenceConfig.java
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource());/*from w w w.j a va 2 s . co m*/ em.setPackagesToScan(new String[] { "org.hellospring4.entities" }); JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(jpaVendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
From source file:config.persistence.VendorAdapterConfig.java
@Profile("production") @Bean(name = "jpaVendorAdapter") public JpaVendorAdapter provideJpaVendorAdapterProd() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setDatabase(Database.MYSQL); adapter.setShowSql(env.getProperty("hibernate.prod.show_sql", Boolean.class)); adapter.setGenerateDdl(env.getProperty("hibernate.prod.hbm2ddl.auto", Boolean.class)); adapter.setDatabasePlatform(env.getProperty("hibernate.prod.dialect")); return adapter; }
From source file:com.tamnd.app.config.HibernateConfig.java
@Bean @Autowired/* w w w .j a va2s. c o m*/ public LocalContainerEntityManagerFactoryBean sessionFactory(DataSource h2DataSource) { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(h2DataSource); factory.setPackagesToScan(new String[] { "com.tamnd.app.core.entities" }); factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); factory.setJpaProperties(hibernateProperties()); return factory; }