使用@JsonIdentityInfo的com.fasterxml.jackson.databind.deser.UnresolvedForwardReference

时间:2015-04-05 15:04:13

标签: java json jackson entity

我有一个错误

这是因为在mj json我有这个元素

"employe": 1,
        "statutControle": {
            "statutControleID": 1,
            "description": "vérification documents ok",
            "controles": [
                1234
            ]
        }

这应该是employeID而不是employee

我为我的实体设置了这个,我正在使用@JsonIdentityInfo:

//bi-directional many-to-one association to Employe
    @ManyToOne
    @JoinColumn(name="employeID")
    private Employe employe;


    com.fasterxml.jackson.databind.deser.UnresolvedForwardReference:
Unresolved forward references for: Object id [1] (for class
com.controletec.siege.db.Employe) at [Source:
/Users/florakalisa/Desktop/workspace/json/ctrl.json; line: 259,
column: 21], Object id [1] (for class com.controletec.siege.db.Test)
at [Source: /Users/florakalisa/Desktop/workspace/json/ctrl.json; line:
268, column: 14], Object id [3] (for class
com.controletec.siege.db.Test) at [Source:
/Users/florakalisa/Desktop/workspace/json/ctrl.json; line: 269,
column: 14], Object id [5] (for class com.controletec.siege.db.Test)
at [Source: /Users/florakalisa/Desktop/workspace/json/ctrl.json; line:
270, column: 14], Object id [7] (for class
com.controletec.siege.db.Test) at [Source:
/Users/florakalisa/Desktop/workspace/json/ctrl.json; line: 271,
column: 14], Object id [9] (for class com.controletec.siege.db.Test)
at [Source: /Users/florakalisa/Desktop/workspace/json/ctrl.json; line:
272, column: 14].

1 个答案:

答案 0 :(得分:0)

请添加完整的Employe类,显示您尝试反序列化的所有jackson注释和json字符串。 这似乎是一个杰克逊的错误,因此id不能出现在他们的完整对象之前。