Skip to content

Commit

Permalink
2312114:
Browse files Browse the repository at this point in the history
  • Loading branch information
suzieep committed Dec 14, 2023
1 parent 8f97762 commit 13202ef
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions TIL/231214.md
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
```

0 comments on commit 13202ef

Please sign in to comment.