我无法运行我的 Spring Boot 应用程序,因为 JPA 存在问题。但我无法找到问题并解决它。我搜索了几个堆栈溢出主题的解决方案,但没有一个解决方案对我有帮助。我定义了以下模型:package xyz.blackmonster.window.models;import java.util.List;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.FetchType;import javax.persistence.GeneratedValue;import javax.persistence.Id;import javax.persistence.OneToMany;import javax.persistence.OneToOne;import org.hibernate.annotations.GenericGenerator;/** * Window order */@Entitypublic class Order { @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid2") private String uuid; @OneToMany(fetch = FetchType.EAGER, mappedBy = "order", cascade = CascadeType.ALL) private List<Window> windows; @OneToOne(fetch = FetchType.EAGER, mappedBy = "order", cascade = CascadeType.ALL) private Service service; @OneToOne(fetch = FetchType.EAGER, mappedBy = "order", cascade = CascadeType.ALL) private Cost cost; @Column(name = "email") private String email; public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public List<Window> getWindows() { return windows; } public void setWindows(List<Window> windows) { this.windows = windows; } public Service getService() { return service; } public void setService(Service service) { this.service = service; } public Cost getCost() { return cost; } public void setCost(Cost cost) { this.cost = cost; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; }}如您所见,实体使用了正确的导入 (javax.persistence.Entity)。我指出这一点,因为这是我遇到的解决方案之一。
添加回答
举报
0/150
提交
取消