코딩/Blog
[18강] User 테이블 생성
멩주
2022. 1. 20. 02:42
@Entity는 table을 가리킨다.
@Id @GerneratedValue @Column @ColumnDefault @CreationTimestamp
테이블이 이미 존재해도 프로젝트 실행마다 새로 만들겠다.
나중에는 update로 설정해야 한다.
ctrl+alt+delete의 작업 관리자에서 MySQL80이 돌고 있는 것을 확인한 후, 프로젝트 실행
application.yml
server:
port: 8000
servlet:
context-path: /blog
encoding:
charset: UTF-8
enabled: true
force: true
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/blog?serverTimezone=Asia/Seoul
username: cos
password: cos1234
jpa:
open-in-view: true
hibernate:
ddl-auto: create
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
use-new-id-generator-mappings: false
show-sql: true
properties:
hibernate.format_sql: true
jackson:
serialization:
fail-on-empty-beans: false
// JPA == ORM
// ORM -> JAVA(다른언어) Object를 테이블로 매핑해주는 기술