Guest User

Untitled

a guest
Nov 9th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. spring.datasource.url=jdbc:mysql://localhost:3306/test
  2. spring.datasource.username=root
  3. spring.datasource.password=root
  4. spring.jpa.show-sql=true
  5. spring.jpa.hibernate.ddl-auto=update
  6. spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
  7. spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  8.  
  9.  
  10. @Autowired
  11. private EntityManagerFactory entityManagerFactory;
  12.  
  13. @Bean
  14. public SessionFactory getSessionFactory() {
  15. if (entityManagerFactory.unwrap(SessionFactory.class) == null) {
  16. throw new NullPointerException("factory is not a hibernate factory");
  17. }
  18. return entityManagerFactory.unwrap(SessionFactory.class);
  19. }
Add Comment
Please, Sign In to add comment