JPA 란?
ORM (Object - Relational Mapping) 프레임 워크
build.gradle 사용
// logback , log4jdbc 설정
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
implementation 'ch.qos.logback:logback-classic:1.2.11'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:jcl-over-slf4j:1.7.36'
//TODO: Jpa 라이브러리
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
application.properties
# 서버 포트
server.port=
# docker db 설정
spring.datasource.driver-class-name=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:oracle:thin:@localhost:1521/xe
spring.datasource.username=
spring.datasource.password=
# jpa 설정
# todo: ddl-auto : create (모든 테이블 재생성) / update (수정된 테이블만 생성) / none(안함)
spring.jpa.hibernate.ddl-auto=create
#spring.jpa.hibernate.ddl-auto=update
# todo: db 제품 연결 ( oracle 12 이상 : Oracle12cDialect )
spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
# todo : generate-ddl=true (테이블 자동 생성 옵션)
spring.jpa.generate-ddl=true
# TODO: sql log 보기 (True / False)
spring.jpa.show-sql=true
# 1) resource/data.sql 자동 실행 ( DML 실행 )
# -> data.sql ( dml 실행 ), schema.sql ( ddl 실행 )
# TODO: dml , ddl 스크립트 (실습용 샘플 테이블 ) 실행을 위한 옵션
spring.jpa.defer-datasource-initialization=true
# TODO: sql log 이쁘게 보여주기
spring.jpa.properties.hibernate.format_sql=true
#Logging Setting , hibernate info 레벨 로깅 설정 : debug, trace 등
# TODO: 로깅 레벨 : 간략정보 : error < info < debug < warn < trace : 상세정보
logging.level.org.hibernate=info
# 2) resource/data.sql 자동 실행 ( DML 실행 )
# -> data.sql ( dml 실행 ), schema.sql ( ddl 실행 )
spring.sql.init.mode=always
# sql 에러 무시하고 스프링 서버 로딩
spring.sql.init.continue-on-error=true
# 자바 소스 변경시 스프링 서버 자동 재시작
spring.devtools.restart.enabled=true
# PUT , DELETE 방식도 form 에서 사용할 수 있게 만들어줌 : jsp 사용시
spring.mvc.hiddenmethod.filter.enabled=true
로그 백 설정
https://tinylittlelife.tistory.com/209
폴더
'SpringBoot > JPA' 카테고리의 다른 글
SpringBoot - JPA - 페이징 처리 (1) | 2023.10.18 |
---|---|
SpringBoot - JPA - 쿼리 메소드와 @Query 어노테이션 (0) | 2023.10.17 |
SpringBoot - JPA - Repository (인터페이스) (0) | 2023.10.16 |
SpringBoot - JPA - Entity class (1) | 2023.10.16 |
SpringBoot - JPA - BaseTimeEntity (생성일자 , 수정일자) (0) | 2023.10.16 |