spring boot @ManytoOne 使用邮递员

问题描述

如果我在 mysql 工作台上使用 insert 语句,它很顺利,但我不知道如何与邮递员发送数据。如何插入?

sql:

INSERT INTO quote (user_id,color,title,quote,writer) values (1,3,"title","quote","writer");

这很好用。

但是

尝试使用邮递员:

{
    "user":{
        "user_id":2,"email":"email","password":"pas","nickname":"nik"
    },"title":"title","quote":"quote","writer":"writer","color":3,}

我试过这种方式,但是用户不输入。

==引用实体==

@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;

@Column(length = 50,nullable = false)
private String title;

@Column(length = 10,nullable = false)
private String writer;

@Column(length = 200,nullable = false)
private String quote;

@ManyToOne
@JoinColumn(name = "user_id")
private User user;

@Column(length = 10,nullable = false)
private int color;

=用户实体=

@JsonIgnore
@Id
@Column(name = "user_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userId;

@Column(name = "email",length = 50,unique = true)
private String email;

@JsonIgnore
@Column(name = "password",length = 100)
private String password;

@Column(name = "nickname",length = 50)
private String nickname;

enter image description here

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...