Create Database Tables from JPA

류홍규·2023년 7월 6일
0

JPA

목록 보기
8/8

💎 Create database tables: student

  • JPA/Hibernate provides an option to automagically create database tables
  • Creates tables based on Java code with JPA/Hibernate annotations

Configuration

  • application.properties
spring.jpa.hibernate.ddl-auto=create

애플리케이션을 실행하면, JPA/Hibernate가 테이블을 drop하고 다시 create해준다.

Property NameProperty 설명
noneNo action will be performed
create-onlyDatabase가 생성되기만 한다.
drop데이터베이스 drop(이때, drop되면 데이터베이스 내용 모두 삭제)
create데이터 베이스 drop하고 다시 생성
create-drop데이터 베이스 drop하고 다시 생성하되, 애플리케이션 종료하면 데이터 베이스 drop
validateValidate the database tabels schema
update테이블 스키마 업데이트(가장 최근 코드로 테이블이 ALTER 되기 때문에 추천하지 않는 방법이다.)
profile
공대생의 코딩 정복기

0개의 댓글

관련 채용 정보