使用Jackson在EXTJS中创建循环模型集群的问题
在创建新模型集群时,我遇到了EXT-JS和Jackson的问题 由此产生了以下问题: 错误fr.package.extjs.web.controller.AbstractSpringController-上的错误 铭文细节。有效说明 org.springframework.http.converter.httpMessageNodeTableException:无法读取JSON:无法解析对象Id[-42](对于[simple type,class] fr.package.inoe.edinting.vo.edintingJourneeTypeVO]——未解析的正向引用? (通过参考链: fr.package.inoe.edinting.vo.edintingdetailvo[“ListSemaneStype”]->fr.package.app.edinting.vo.edintingSemaneStypevo[“ListJourneeTypevo”]->fr.package.app.edinting.vo.edintingCreneeAuttypevo[“journeeType”]->;嵌套异常为com.fasterxml.jackson.databind.JsonMappingException:无法解析对象Id[-42](对于[simple type,class fr.package.app.Pendition.vo.PenditionJourneeTypeVO])--未解析的正向引用?(通过引用链:fr.package.app.edinting.vo.edintingdetailvo[“listedemainestype”]->fr.package.app.edintingseminetypevo[“listedjourneestype”]->fr.package.app.edintinge.vo[“listedcreneauxtype”]->fr.package.app.edintingcreneautypevo[“journeeType”]) 位于fr.package.extjs.utils.JSONUtils.fromJsonString(JSONUtils.java:44)使用Jackson在EXTJS中创建循环模型集群的问题,extjs,jackson,Extjs,Jackson,在创建新模型集群时,我遇到了EXT-JS和Jackson的问题 由此产生了以下问题: 错误fr.package.extjs.web.controller.AbstractSpringController-上的错误 铭文细节。有效说明 org.springframework.http.converter.httpMessageNodeTableException:无法读取JSON:无法解析对象Id[-42](对于[simple type,class] fr.package.inoe.edintin
以下是我的模型在java中的表达方式:
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class InscriptionSemaineTypeVO extends InoeVO<SemaineType, Long> implements java.lang.Comparable<InscriptionSemaineTypeVO> {
private static final long serialVersionUID = 1L;
public Long id;
private int version;
private int tri;
// @JsonBackReference("Inscription-listeSemainesType")
private InscriptionDetailVO inscription;
// @JsonManagedReference("InscriptionSemaineTypeVO-listeJourneesType")
private List<InscriptionJourneeTypeVO> listeJourneesType;
private long arrondiInMilli;
}))
}))
最后,为了创建这些模型,我正在做以下工作:
var newSemaine = Ext.create("AM.model.inscription.InscriptionSemaineTypeVO", {
inscription : inscriptionId,
id : -1,
//'arrondiInMilli' : '',
//'attributsVO' : '',
//listeJourneesType : newJournee.data,
//'tri' : '',
//'id' : '',
});
var newJournee = Ext.create("AM.model.inscription.JourneeType", {
id :-2,
arrondi : "00:00:00",
});
var newCreneau = Ext.create("AM.model.inscription.CreneauType" ,{
arrivee : "00:00:00",
depart: "00:00:00",
arrondi : "00:00:00",
id : -3,
});
newJournee.set(
{
semaineType : newSemaine.data.id,
listeCreneauxType : newCreneau.data,
});
newCreneau.set(
{
// journeeType : newJournee.data.id,
journeeType : -42,
});
newSemaine.set({
listeJourneesType : newJournee.data,
})
storeParents.getRange()[0].listeSemainesTypeStore.add(newSemaine);
storeParents.getRange()[0].setDirty(true);
我在Jackson的github上发现了一个问题,但似乎还没有解决
你知道我怎么能坚持下去吗
提前谢谢你!(很抱歉发了这么长的帖子
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class InscriptionCreneauTypeVO extends InoeVO<CreneauType, Long> {
private static final long serialVersionUID = 1L;
public Long id;
private int version;
private Time arrivee;
private Time depart;
private Time arrondi;
// @JsonBackReference("InscriptionJourneeTypeVO-listeCreneauxType")
private InscriptionJourneeTypeVO journeeType;
Ext.define('AM.model.inscription.InscriptionSemaineTypeVO', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name: 'version', type: 'string'},
{name: 'tri', type: 'string'},
{name: 'inscription', type: 'int'},
{name: 'listeJourneesType'},
{name: 'arrondiInMilli', type: 'string'},
{name: 'persistantClass', type: 'string'}
],
associations:
[
{
type : 'hasMany',
name: 'listeJourneesType',
model: 'AM.model.inscription.JourneeType'
},
]
Ext.define('AM.model.inscription.JourneeType', {
extend: 'Ext.data.Model',
fields: [
{name: 'numero', type: 'string'},
{name: 'repas', type: 'string'},
{name: 'arrondi', type: 'string'},
{name: 'semaineType'},
{name: 'listeCreneauxType'},
{name: 'id', type: 'int'},
{name: 'version', type: 'int'}
],
associations:
[
{
type : 'hasMany',
name: 'listeCreneauxType',
model: 'AM.model.inscription.CreneauType'
},
{
type : 'hasOne',
name: 'semaineType',
model: 'AM.model.inscription.InscriptionSemaineTypeVO'
},
]
});
Ext.define('AM.model.inscription.CreneauType',
{
extend: 'Ext.data.Model',
fields:
[
{name: 'arrivee', type: 'string'},
{name: 'depart', type: 'string'},
{name: 'arrondi', type: 'string'},
{name: 'journeeType'},
{name: 'uid', type: 'string'},
{name: 'id', type: 'int'},
{name: 'version', type: 'int'}
],
associations:
[
{
type : 'hasOne',
name: 'journeeType',
model: 'AM.model.inscription.JourneeType'
},
],
var newSemaine = Ext.create("AM.model.inscription.InscriptionSemaineTypeVO", {
inscription : inscriptionId,
id : -1,
//'arrondiInMilli' : '',
//'attributsVO' : '',
//listeJourneesType : newJournee.data,
//'tri' : '',
//'id' : '',
});
var newJournee = Ext.create("AM.model.inscription.JourneeType", {
id :-2,
arrondi : "00:00:00",
});
var newCreneau = Ext.create("AM.model.inscription.CreneauType" ,{
arrivee : "00:00:00",
depart: "00:00:00",
arrondi : "00:00:00",
id : -3,
});
newJournee.set(
{
semaineType : newSemaine.data.id,
listeCreneauxType : newCreneau.data,
});
newCreneau.set(
{
// journeeType : newJournee.data.id,
journeeType : -42,
});
newSemaine.set({
listeJourneesType : newJournee.data,
})
storeParents.getRange()[0].listeSemainesTypeStore.add(newSemaine);
storeParents.getRange()[0].setDirty(true);