Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
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
Tags
more
Archives
Today
Total
관리 메뉴

지우쓰 개발일기

[JPA] persistence.xml 기본 설정 본문

Spring Boot/JPA

[JPA] persistence.xml 기본 설정

jiwoo-kimm 2020. 9. 8. 23:53

본 포스팅은 자바 ORM 표준 JPA 프로그래밍 (김영한 저)을 읽고 정리한 내용입니다.

 

자바 ORM 표준 JPA 프로그래밍

에이콘 오픈 소스 프로그래밍 시리즈. 이 책은 JPA 기초 이론과 핵심 원리, 그리고 실무에 필요한 성능 최적화 방법까지 JPA에 대한 모든 것을 다룬다.

www.aladin.co.kr


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