본문 바로가기
스프링부트 개념정리 with JPA

[메타코딩] 스프링부트 개념정리 with JPA 7강

by yukuda 2024. 3. 13.
728x90

- OOP 관점에서 모델링이란?

 

Class Car {

    int id; (PK)

    String name;

    String color;

    Engine engine;

    TimeStamp createDate;

    TimeStamp updateDate;

}

 

Class Engine {

    int id;

    int power;

    TimeStamp createDate;

    TimeStamp updateDate;

}

 

JPA 자동생성

 

Class EntityDate {

    TimeStamp createDate;

    TImeStamp updateData;

}

 

기존 Car, Engine  클래스에 EntityDate를 상속

Class Card extends EntityDate {}

Class Engine  extends EntityDate {}

 

 

- 방언 처리가 용이하여 Migration하기 좋음. 유지보수에도 좋음.

추상화 객체를 이용해 DB에 연결

https://youtu.be/vRoZAMX95Mc