Thanks for your information. My opinion: while being designed this way , it may just end up with an error if there are fields with same name. Going on may cause serious problem. Or it may be more compatible, maybe figure out a way to support both flat model and hierarchy model.
Is there any other designed restrictions and any document about them : ) 2014/1/8 Scott Ferguson <f...@caucho.com> > On 1/7/14, 6:44 AM, yuneng xie wrote: > > Hello > > I encountered this problem that, after deserialization, a filed's value > of a child class will be covered by the field's vlaue of its parent class, > if the name of two fileds is the same. > > for example: > > class P{ > String str="parent"; > } > class C extends P{ > String str="child; > } > > > After deserialization, C.str will be covered by P.str. > > I find the cause is that the _fieldMap structure in > JavaDeserializer.java which is used to store all fields of the whole class > hierarchy. The _fieldMap use field name as key. If there are two fields > with same name in the class hierarchy, only one will be kept in the map. > > I tried to fix this by changing _fieldMap from Map<String,Field> to > Map<String,List<Field>> and it worked fine for simple test. but I'm not > sure if it will cause other problems. > > Anybody else ever encountered this problem? > > > That's not actually a problem; it's part of the design of Hessian, because > Hessian is designed to be cross-language, so it doesn't encode the entire > class hierarchy, only the top class and its fields. > > So classes designed for Hessian serialization need to have unique field > names. > > -- Scott > > > > _______________________________________________ > hessian-interest mailing > listhessian-interest@caucho.comhttp://maillist.caucho.com/mailman/listinfo/hessian-interest > > > > _______________________________________________ > hessian-interest mailing list > hessian-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/hessian-interest > >
_______________________________________________ hessian-interest mailing list hessian-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/hessian-interest