Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
deserialising a json file with jackson : UnresolvedForwardReference
A. Aka
Ranch Hand
Posts: 101
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
when deserializing this file :
[ { "numConvocation": 1234, "assurance": 1, "conformite": 1, "convocation": 1, "dateControle": 1428173139000, "montant": 0, "paye": 0, "resultatFinal": "Négatif", "scoreFinal": 21, "surtaxe": 0, "ligne": { "ligneID": 1, "enPanne": 1, "bancs": [ { "@id": 1, "id": { "@id": 1, "ligneID": 1, "numTest": 1 }, "enPanne": 1, "ligne": 1, "type": "1", "tests": [ { "@id": 1, "id": { "@id": 2, "ligneID": 1, "numTest": 1, "numConvocation": 1234 }, "reserve": 0, "score": 1, "banc": 1, "controle": 1234, "employe": { "employeID": 1, "actif": 1, "login": "toto", "nom": "Dupont", "password": "d74ff0ee8da3b9806b18c877dbf29bbde50b5bd8e4dad7a3a725000feb82e8f1", "prenom": "Thomas", "controles": [ 1234 ], "type": "1", "tests": [ 1, { "@id": 3, "id": { "@id": 4, "ligneID": 1, "numTest": 2, "numConvocation": 1234 }, "reserve": 1, "score": 10, "banc": { "@id": 2, "id": { "@id": 2, "ligneID": 1, "numTest": 2 }, "enPanne": 0, "ligne": 1, "type": "1", "tests": [ 3 ] }, "controle": 1234, "employe": 1, "description": "Rejet de CO2", "infoReserve": "(réserve)", "evaluation": "insuffisante" }, { "@id": 5, "id": { "@id": 6, "ligneID": 1, "numTest": 3, "numConvocation": 1234 }, "reserve": 1, "score": 10, "banc": { "@id": 3, "id": { "@id": 3, "ligneID": 1, "numTest": 3 }, "enPanne": 1, "ligne": 1, "type": "1", "tests": [ 5 ] }, "controle": 1234, "employe": 1, "description": "Stabilité des ammortisseurs", "infoReserve": "(réserve)", "evaluation": "10%" }, { "@id": 7, "id": { "@id": 8, "ligneID": 1, "numTest": 4, "numConvocation": 1234 }, "reserve": 0, "score": 0, "banc": { "@id": 4, "id": { "@id": 4, "ligneID": 1, "numTest": 4 }, "enPanne": 0, "ligne": 1, "type": "1", "tests": [ 7 ] }, "controle": 1234, "employe": 1, "description": "Etat de la carrosserie", "infoReserve": "", "evaluation": "impeccable" }, { "@id": 9, "id": { "@id": 10, "ligneID": 1, "numTest": 5, "numConvocation": 1234 }, "reserve": 0, "score": 0, "banc": { "@id": 5, "id": { "@id": 5, "ligneID": 1, "numTest": 5 }, "enPanne": 0, "ligne": 1, "type": "1", "tests": [ 9 ] }, "controle": 1234, "employe": 1, "description": "Etat du bas de caisse", "infoReserve": "", "evaluation": "impeccable" } ] }, "description": "Puissance de freinage", "infoReserve": "", "evaluation": "acceptable" } ] }, 2, 3, 4, 5, { "@id": 6, "id": { "@id": 6, "ligneID": 1, "numTest": 6 }, "enPanne": 1, "ligne": 1, "type": "1", "tests": [] }, { "@id": 7, "id": { "@id": 7, "ligneID": 1, "numTest": 7 }, "enPanne": 1, "ligne": 1, "type": "1", "tests": [] } ], "controles": [ 1234 ], "type": "1" }, "convocationBean": { "numConvocation": 1234, "cloture": 1, "dateLimite": "2015-04-03", "nbrRappels": 1, "controle": 1234, "vehicule": { "numPlaque": "016CIS", "annee": "1989", "carburant": "E", "couleur": "rouille", "marque": "Mercedes", "modele": "Classe A", "numChassis": "WDBKD9EHMRY421405", "type": "N", "convocations": [ 1234 ], "proprietaire": { "proprietaireID": 1919, "denomination": null, "nom": "Allen", "numRegNat": null, "numTVA": null, "prenom": "Didier", "telephone": "", "adresse": { "adresseID": 2234, "boite": "1", "codepostal": "8000", "numero": "117", "rue": "boulevard François Ier", "ville": "Bruges", "proprietaires": [ 1919 ] }, "type": "1", "vehicules": [ "016CIS" ] } } }, "employe": 1, "statutControle": { "statutControleID": 1, "description": "vérification documents ok", "controles": [ 1234 ] }, "tests": [ 1, 3, 5, 7, 9 ] } ]
I have this error :
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].
any idea what is the problem ?
A. Aka
Ranch Hand
Posts: 101
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I know the problem but I do not know how to solve it :
employe in my json should be employeID,
and I have this on my entity :
@Entity @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="employeID", scope = Employe.class) public class Employe implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int employeID; private int actif;
but I have also this :
@Entity @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="numConvocation", scope = Controle.class) public class Controle implements Serializable { private static final long serialVersionUID = 1L; @Id private int numConvocation; private int assurance; private int conformite; private int convocation; private Date dateControle; private int montant; private int paye; private String resultatFinal; private int scoreFinal; private int surtaxe; @ManyToOne @JoinColumn(name="ligneID") private Ligne ligne; @OneToOne(cascade= CascadeType.ALL) @JoinColumn(name="numConvocation") private Convocation convocationBean; @ManyToOne @JoinColumn(name="employeID") private Employe employe; @ManyToOne @JoinColumn(name="statutControleID") private StatutControle statutControle; @OneToMany(fetch = FetchType.LAZY, mappedBy="controle") private List<Test> tests; public Controle() { }
A. Aka
Ranch Hand
Posts: 101
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
the problem is
"employe": 1
while this should be :
"employe": { "employeID": 1, "actif": 1, "login": "toto", "nom": "Dupont", "password": "d74ff0ee8da3b9806b18c877dbf29bbde50b5bd8e4dad7a3a725000feb82e8f1", "prenom": "Thomas", "controles": [ 1234 ], "type": "1"}
any idea on how to solve it ?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
jackson : Could not read JSON: Already had POJO for id
Test class shows error
Problem to display clob data
Sql Query to find the change in Column
More...