지우쓰 개발일기
[JPA] persistence.xml 기본 설정 본문
본 포스팅은 자바 ORM 표준 JPA 프로그래밍 (김영한 저)을 읽고 정리한 내용입니다.
persistence.xml
JPA는 persistence.xml
을 사용해서 필요한 설정 정보를 관리한다.
이 파일이 META-INF/persistence.xml
경로에 있으면 JPA가 자동으로 인식한다.
persistence
-
xmlns
: XML 네임스페이스 -
version
: JPA 버전
persistence-unit
-
연결할 DB당 하나의 persistence-unit 등록
-
name
: 고유한 이름 부여
properties
- JPA 표준 속성
-
javax.persistence.jdbc.driver
: JDBC 드라이버 -
javax.persistence.jdbc.user
: DB 접속 아이디 -
javax.persistence.jdbc.password
: DB 접속 비밀번호 -
javax.persistence.jdbc.url
: DB 접속 URL
- Hibernate 속성
-
hibernate.dialect
: DB dialect 설정-
H2:
org.hibernate.dialect.H2Dialect
-
Oracle:
org.hibernate.dialect.Oracle10gDialect
-
MySQL:
org.hibernate.dialect.MySQL5InnoDBDialect
-
'Spring Boot > JPA' 카테고리의 다른 글
[JPA] Persistence Context (0) | 2020.09.09 |
---|---|
[JPA] JPQL 개요 (0) | 2020.09.09 |
[JPA] CRUD 기본 (0) | 2020.09.09 |
[JPA] 매핑 정보 Annotation (0) | 2020.09.08 |
[JPA] JPA란 무엇인가? (0) | 2020.09.08 |
Comments