@Entity
@Table(name = "restaurants")
public class Restaurant {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String description;
@Column(nullable = false)
private Integer minDeliveryPrice;
@Column(nullable = false)
private String status;
@Column(nullable = false, length = 55)
private String operationHours;
@Column(nullable = false)
private String address;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "owner_id", nullable = false)
private User owner;
@OneToMany(mappedBy = "restaurant", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Order> ordersList = new ArrayList<>();
@OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Menu> menuList = new ArrayList<>();
}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Collection 'com.sparta.spring26.domain.restaurant.entity.Restaurant.menuList' is 'mappedBy' a property named 'menu' which does not exist in the target entity 'com.sparta.spring26.domain.menu.entity.Menu'
OneToMany 관계 설정중 mappedBy를 잘못 설정해서 발생한 예외
menu -> restaurant로 수정해서 해결