当我们不使用Json post方法编写时,如何在Entity上设置defaultValue并忽略该列

时间:2019-06-23 12:52:47

标签: java spring-boot jpa jackson

我真的想在我的实体中设置默认值,假设我有表客户,并且我希望read column为默认false,

我尝试为该列使用@JsonIgnore,但未在请求正文中编写post方法,但出现一些错误 错误是这样的:

  "org.hibernate.exception.SQLGrammarException: could not execute
 statement; nested exception is 
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement"

我的请求正文:

{ name: "test" }

我说过要在请求正文中忽略键和值read column,因为它已经默认为false

我上面有错误 我想要发布后的结果,显示json这样的

{ name: "test", read: false }

0 个答案:

没有答案