我正在使用WizTools.org RESTClient 3.2.2&想要将输入参数传递为
{
"user_id": "",
"user_email_id": "a@a.a",
"user_password": "fdsdsdf",
"firstname": "sdfsdf",
"lastname": "sfdsdfds",
"mobile_number": "1234567890",
"user_status": 1,
"isdeleted": 0,
"created_by": 1,
"profile_picturename": "kfksdjfhksjd",
"address": "sfdsdfsd"
}
这里创建一个新记录我希望将用户ID传递为“user_id”:“”,但是其他客户端显示异常为“java.sql.SQLException:不正确的整数值:''对于列'pv_user_id'在行44"
任何人都可以建议我如何将null值传递给userID,我的模型类是
@Column(name = "user_id")
private String user_id;
@Id
@Column(name = "user_email_id")
@NotEmpty(message = "Please enter your email_Id.")
@Email
@NotNull(message = "Enter last name")
private String user_email_id;
@NotEmpty(message = "Please enter your password.")
@Column(name = "user_password")
private String user_password;
@NotNull(message = "Enter last name")
@NotEmpty(message = "Please enter your firstName.")
@Column(name = "firstname")
private String firstname;
@NotNull(message = "Enter last name")
@NotEmpty(message = "Please enter your lastName.")
@Column(name = "lastname")
private String lastname;
// @NotNull
@NotEmpty
@Pattern(regexp = "(^[0-9]{10,12}$)", message = "Please enter your Mobile Number.")
@NumberFormat
// @Size(min = 10, max = 12)
@Column(name = "mobile_number")
private String mobile_number;
@Column(name = "user_status")
private Integer user_status;
@Column(name = "isdeleted")
private Integer isdeleted;
@Column(name = "created_by")
private Integer created_by;
@Column(name = "profile_picturename")
private String profile_picturename;
@Column(name = "address")
private String address;
提前致谢
答案 0 :(得分:2)
如果你没有传递userId参数,它将使userId = null,因为userId是String,如果你没有传递任何东西,它会自动将它作为null。
即使这个链接也有助于理解原因..