Advertisement
Guest User

Untitled

a guest
Dec 25th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Application properties:
  2.  
  3. # DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
  4. spring.datasource.driver-class-name = com.mysql.jdbc.Driver
  5. spring.datasource.url = jdbc:mysql://localhost:3306/post
  6. spring.datasource.sql-script-encoding=UTF-8
  7. spring.datasource.username = *******
  8. spring.datasource.password = *******
  9.  
  10. # JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
  11. spring.jpa.database-platform = org.hibernate.dialect.MySQLDialect
  12. spring.jpa.hibernate.hbm2ddl.auto = create
  13. spring.jpa.generate-ddl = true
  14. spring.jpa.show-sql = false
  15.  
  16. @Bean
  17. public LocalContainerEntityManagerFactoryBean em(DataSource
  18. source,JpaVendorAdapter adapter) {
  19. Properties properties = new Properties();
  20. properties.setProperty("hibernate.hbm2ddl.auto", "create");
  21.  
  22. LocalContainerEntityManagerFactoryBean em
  23. = new LocalContainerEntityManagerFactoryBean();
  24.  
  25. em.setDataSource(source);
  26. em.setPackagesToScan("*******");
  27. em.setJpaVendorAdapter(adapter);
  28. em.setJpaProperties(properties);
  29.  
  30. return em;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement