Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- database
- dbeaver
- JavaScript
- Git
- nodejs
- maven
- BPMN
- MySQL
- VSCode
- NCP
- Kubernetes
- nginx
- log4j2
- Windows
- gson
- sapfiorielements
- mybatis
- Spring
- react
- Linux
- gradle
- springboot
- tibero
- SAP
- IntelliJ
- LOG4J
- JPA
- Java
- docker
- useEffect
Archives
- Today
- Total
두 손끝의 창조자
LocalContainerEntityManagerFactoryBean 으로 EntityManagerFactory 설정 본문
persistence.xml 는 필요없다.
entityManagerFactoryBean.afterPropertiesSet(); 는 가장 마지막에 호출해줘야 한다.
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
Map<String, String> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("hibernate.show_sql", "true");
objectObjectHashMap.put("hibernate.format_sql", "true");
objectObjectHashMap.put("hibernate.user_sql_comments", "true");
objectObjectHashMap.put("hibernate.hbm2ddl.auto", "create");
entityManagerFactoryBean.setJpaPropertyMap(objectObjectHashMap);
entityManagerFactoryBean.setPackagesToScan("cothe");
entityManagerFactoryBean.afterPropertiesSet();
return entityManagerFactoryBean.getObject();
반응형
Comments