Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spring.datasource.url=jdbc:mysql://localhost:3306/test
- spring.datasource.username=root
- spring.datasource.password=root
- spring.jpa.show-sql=true
- spring.jpa.hibernate.ddl-auto=update
- spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
- @Autowired
- private EntityManagerFactory entityManagerFactory;
- @Bean
- public SessionFactory getSessionFactory() {
- if (entityManagerFactory.unwrap(SessionFactory.class) == null) {
- throw new NullPointerException("factory is not a hibernate factory");
- }
- return entityManagerFactory.unwrap(SessionFactory.class);
- }
Add Comment
Please, Sign In to add comment