주문 리포지토리 개발

  1. 주문 저장

  2. 주문 조회 주문 id로 조회(단일 검색) em.find(Order.class,id)

package jpabook.jpashop.repository;

import jpabook.jpashop.domain.Order;
import lombok.RequiredArgsConstructor;
import org.aspectj.weaver.ast.Or;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import java.util.List;

@Repository
@RequiredArgsConstructor
public class OrderRepository {
    private final EntityManager em;
    public void save(Order order){
        em.persist(order);
    }
    public Order findOne(Long id){
        return em.find(Order.class,id);
    }

    //검색 기능
//    public List<Order> findAll(OrderSearch orderSearch){}
}

Last updated