小编Rus*_*lan的帖子

没有从字符串值反序列化的字符串参数构造函数/工厂方法('1074')

我是 Spring DataJPA + REST 项目的新手,我正在尝试从具有 OneToOne 单向关系的参考 EmployerType 执行添加新或编辑 Employer。任务很简单,但我被卡住了。当我尝试添加或编辑数据时,出现此错误:

org.springframework.http.converter.HttpMessageNotReadableException:
Could not read document: Can not construct instance of
tr.mis.domain.EmployerType: no String-argument constructor/factory
method to deserialize from String value ('1074')  at [Source:
java.io.PushbackInputStream@6d856887; line: 1, column: 609] (through
reference chain: tr.mis.domain.Employer["employerType"]); nested
exception is com.fasterxml.jackson.databind.JsonMappingException: Can
not construct instance of tr.mis.domain.EmployerType: no
String-argument constructor/factory method to deserialize from String
value ('1074')
Run Code Online (Sandbox Code Playgroud)

以下是有关课程的信息。

@Entity
@Table(name = "employer")
public class Employer implements Serializable  {
    @GenericGenerator(
            name = "wikiSequenceGenerator",
            strategy = …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-data-jpa spring-boot spring-rest

3
推荐指数
1
解决办法
6496
查看次数