ID类型匹配JPA要求

This commit is contained in:
myh 2023-11-06 18:39:06 +08:00
parent 435f768659
commit 0c7e5753f4
4 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ import java.math.BigDecimal;
public class Dishes { public class Dishes {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键菜品ID private Long id;//主键菜品ID
private String name;//菜品名称 private String name;//菜品名称
private BigDecimal price;//菜品价格 private BigDecimal price;//菜品价格
private Integer discount;//菜品折扣 private Integer discount;//菜品折扣

View File

@ -14,7 +14,7 @@ import java.util.List;
public class Merchants { public class Merchants {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键,商家编号 private Long id;//主键,商家编号
private String name;//店铺名字 private String name;//店铺名字
private String address;//店铺地址 private String address;//店铺地址
@Column(name = "phoneNumber") @Column(name = "phoneNumber")

View File

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
public class OrderDishes { public class OrderDishes {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键ID private Long id;//主键ID
@OneToOne(cascade = CascadeType.ALL) @OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "dishesID", referencedColumnName = "id") @JoinColumn(name = "dishesID", referencedColumnName = "id")

View File

@ -21,7 +21,7 @@ import java.util.List;
public class Orders { public class Orders {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//订单ID private Long id;//订单ID
@OneToMany(cascade = CascadeType.ALL, mappedBy = "orders") @OneToMany(cascade = CascadeType.ALL, mappedBy = "orders")
@Column(name = "orderDishesID") @Column(name = "orderDishesID")