-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# 231214 | ||
|
||
telnet | ||
|
||
```shell | ||
brew install telnet | ||
telnet [hostIP/Domain] [port] | ||
``` | ||
|
||
내 ip | ||
ifconfig | grep inet | ||
|
||
# #Fetch Type | ||
|
||
Lazy loading | ||
|
||
- 연관된 Entity를 proxy로 조회 | ||
- proxy를 실제로 사용할 때 초기화하면서 데이터베이스 조회 | ||
|
||
Eager loading | ||
|
||
- 연관된 Entity를 즉시 조회 | ||
- Hibernate는 가능하면 SQL join으로 한 번에 조회함 | ||
|
||
기본 Fetch Stategy | ||
@ManyToOne, @OneToOne : Eager | ||
@OneToMany, @ManyToMany : Lazy | ||
|
||
- 기본적으로 Lazy 사용!! | ||
|
||
## 온라인쇼핑몰 DB 짜보기(temp) | ||
|
||
```dbml | ||
// 쿠폰적용 | ||
// 장바구니 로그인 안한 유저도 담도록? | ||
table customer { | ||
id int [pk, increment] | ||
name varchar | ||
email varchar | ||
address varchar | ||
} | ||
table product { | ||
id int [pk, increment] | ||
name varchar | ||
price decimal | ||
stock_amount int | ||
} | ||
table order { | ||
id int [pk, increment] | ||
order_date date | ||
order_status varchar | ||
customer_id int // [ref: > customer.id] | ||
} | ||
table line_item { | ||
id int [pk, increment] | ||
quantity int | ||
price decimal | ||
product_id int // [ref: > product.id] | ||
cart_id int // [ref: > cart.id] | ||
order_id int // [ref: > order.id] | ||
} | ||
table payment { | ||
id int [pk, increment] | ||
payment_date date | ||
amount decimal | ||
order_id int // [ref: > order.id] | ||
} | ||
table cart { | ||
id int [pk, increment] | ||
user_id int | ||
created_date date | ||
} | ||
ref: order.customer_id > customer.id | ||
ref: line_item.order_id > order.id | ||
ref: line_item.product_id > product.id | ||
ref: line_item.cart_id > cart.id | ||
ref: payment.order_id > order.id | ||
ref: cart.user_id > customer.id | ||
``` |