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
- maven
- Java
- LOG4J
- nodejs
- nginx
- VSCode
- Linux
- mybatis
- MySQL
- springboot
- tibero
- JavaScript
- kubectl
- Spring
- IntelliJ
- SAP
- log4j2
- react
- gradle
- database
- Windows
- BPMN
- Git
- Kubernetes
- JPA
- dbeaver
- NCP
- gson
- 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