Skip to content

Commit

Permalink
SCRUM-45 feat: order 연관관계 매핑 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
yeopyeop-82 committed Aug 12, 2024
1 parent 03a2db9 commit 7bd2acc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kakaoteck.golagola.domain.order.entity;

import com.kakaoteck.golagola.domain.buyer.entity.Buyer;
import com.kakaoteck.golagola.domain.orderProduct.entity.OrderProduct;
import com.kakaoteck.golagola.domain.seller.entity.Seller;
import com.kakaoteck.golagola.global.common.BaseEntity;
import com.kakaoteck.golagola.global.common.enums.OrderStatus;
Expand All @@ -11,6 +12,7 @@
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.List;

@Entity
@NoArgsConstructor
Expand All @@ -32,6 +34,9 @@ public class Order extends BaseEntity {
@JoinColumn(name = "buyer_id")
private Buyer buyer;

@OneToMany(mappedBy = "order", cascade = CascadeType.ALL)
private List<OrderProduct> orderProductList;

private boolean isPay;
private LocalDate paymentDate;
private String orderAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kakaoteck.golagola.domain.orderProduct.entity;

import com.kakaoteck.golagola.domain.order.entity.Order;
import com.kakaoteck.golagola.domain.product.entity.Product;
import com.kakaoteck.golagola.domain.review.entity.Review;
import jakarta.persistence.*;
Expand All @@ -24,6 +25,10 @@ public class OrderProduct {
@JoinColumn(name = "product_id")
private Product product;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "order_id")
private Order order;

@OneToOne(mappedBy = "orderProduct", cascade = CascadeType.ALL)
private Review review;

Expand Down

0 comments on commit 7bd2acc

Please sign in to comment.