Apache flex BlazeDS为什么不序列化某些字段?

Apache flex BlazeDS为什么不序列化某些字段?,apache-flex,serialization,blazeds,Apache Flex,Serialization,Blazeds,我使用Flex3.5、BlazeDS 3.2.0.3978和EJB3作为后端。有两个RPC对该问题很重要。第一个调用将获得第三方对象的列表,这很好。第二个调用发生在用户单击第三方时,检索此对象(惰性集合)的详细信息。返回单个对象时,大多数字段都已序列化。我说的最多,是因为出于某种原因,4个布尔字段没有序列化,默认情况下flex将它们设置为false 以下是java bean: package com.rekencentra.svc.cfos.model.security; @Entity @

我使用Flex3.5、BlazeDS 3.2.0.3978和EJB3作为后端。有两个RPC对该问题很重要。第一个调用将获得第三方对象的列表,这很好。第二个调用发生在用户单击第三方时,检索此对象(惰性集合)的详细信息。返回单个对象时,大多数字段都已序列化。我说的最多,是因为出于某种原因,4个布尔字段没有序列化,默认情况下flex将它们设置为false

以下是java bean:

package com.rekencentra.svc.cfos.model.security; @Entity @Table( name = "AUTH_THP", uniqueConstraints = { @UniqueConstraint(columnNames={"THP_ID", "OTH_THP_ID"}) } ) @NamedQueries({ @NamedQuery( name="allAuthorizationsForThp", query="SELECT DISTINCT c FROM AuthorisationThirdParty c " + " LEFT JOIN FETCH c.otherThirdParty thp" + " LEFT JOIN FETCH thp.goodRegulation" + " WHERE c.thirdParty.id = :id" + " AND c.authValidFrom = sysdate()" )} ) @SequenceGenerator(name="seqSerialId", sequenceName="SEQ_AUTH_THP") public class AuthorisationThirdParty extends BusinessObject { private static final long serialVersionUID = -4187381385945255374L; @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.REFRESH}) @JoinColumn(name="THP_ID", nullable=false) private ThirdParty thirdParty; @ManyToOne(fetch=FetchType.EAGER, cascade = {CascadeType.REFRESH}) @JoinColumn(name="OTH_THP_ID", nullable=false) private ThirdParty otherThirdParty; @Column(name="ICT_F", nullable=false) private Boolean authForTemplates; @Column(name="ICN_F", nullable=false) private Boolean authForConsignments; @Column(name="SC_F", nullable=false) private Boolean authForSalesContracts; @Column(name="PC_F", nullable=false) private Boolean authForPurchaseContracts; @Column(name="FROM_DATE", nullable=true) @Temporal(TemporalType.DATE) private Date authValidFrom; @Column(name="UNTIL_DATE", nullable=true) @Temporal(TemporalType.DATE) private Date authValidTo; public ThirdParty getThirdParty() { return thirdParty; } public void setThirdParty(ThirdParty thirdParty) { this.thirdParty = thirdParty; } public ThirdParty getOtherThirdParty() { return otherThirdParty; } public void setOtherThirdParty(ThirdParty otherThirdParty) { this.otherThirdParty = otherThirdParty; } public Date getAuthValidFrom() { return authValidFrom; } public void setAuthValidFrom(Date authValidFrom) { this.authValidFrom = authValidFrom; } public Date getAuthValidTo() { return authValidTo; } public void setAuthValidTo(Date authValidTo) { this.authValidTo = authValidTo; } public void setAuthForTemplates(Boolean authForTemplates) { this.authForTemplates = authForTemplates; } public boolean isAuthForTemplates() { return authForTemplates; } public void setAuthForConsignments(Boolean authForConsignments) { this.authForConsignments = authForConsignments; } public boolean isAuthForConsignments() { return authForConsignments; } public void setAuthForSalesContracts(Boolean authForSalesContracts) { this.authForSalesContracts = authForSalesContracts; } public boolean isAuthForSalesContracts() { return authForSalesContracts; } public void setAuthForPurchaseContracts(Boolean authForPurchaseContracts) { this.authForPurchaseContracts = authForPurchaseContracts; } public boolean isAuthForPurchaseContracts() { return authForPurchaseContracts; } } 包com.rekencentra.svc.cfos.model.security; @实体 @桌子( name=“AUTH_THP”, 唯一约束={ @UniqueConstraint(列名={“THP_ID”,“OTH_THP_ID”}) } ) @命名查询({ @命名查询( name=“allAuthorizationsForThp”, query=“从授权第三方c中选择不同的c”+ “左连接获取c.otherThirdParty thp”+ “左连接获取thp.GOODREQUIRATION”+ “其中c.thirdParty.id=:id”+ “和c.authValidFrom=sysdate()” )} ) @SequenceGenerator(name=“seqSerialId”,sequenceName=“SEQ\u AUTH\u THP”) 公共类授权第三方扩展BusinessObject{ 私有静态最终长serialVersionUID=-4187385945255374L; @manytone(fetch=FetchType.LAZY,cascade={CascadeType.REFRESH}) @JoinColumn(name=“THP_ID”,null=false) 私人第三方第三方; @manytone(fetch=FetchType.EAGER,cascade={CascadeType.REFRESH}) @JoinColumn(name=“OTH_THP_ID”,nullable=false) 私人第三方或其他第三方; @列(name=“ICT\u F”,null=false) 私有布尔authForTemplates; @列(name=“ICN\u F”,null=false) 私人托运; @列(name=“SC\u F”,null=false) 私人买卖合同; @列(name=“PC\u F”,null=false) 私人采购合同; @列(name=“FROM_DATE”,nullable=true) @时态(TemporalType.DATE) 私人日期授权自; @列(name=“UNTIL_DATE”,nullable=true) @时态(TemporalType.DATE) 私人日期授权; 公共第三方获得第三方(){ 返回第三方; } 公共无效设定第三方(第三方第三方){ this.third party=第三方; } 公共第三方获得其他第三方(){ 返回其他第三方; } 公共无效设置其他第三方(第三方其他第三方){ this.otherThirdParty=其他第三方; } 公共日期getAuthValidFrom(){ 返回authValidFrom; } public void setAuthValidFrom(日期authValidFrom){ this.authValidFrom=authValidFrom; } 公开日期getAuthValidTo(){ 返回authValidTo; } 公共无效设置authValidTo(日期authValidTo){ this.authValidTo=authValidTo; } public void setAuthForTemplates(布尔authForTemplates){ this.authForTemplates=authForTemplates; } 公共布尔值isAuthForTemplates(){ 返回模板; } public void setAuthForCommissions(布尔AuthForCommissions){ this.authforcommissions=authforcommissions; } 公共布尔值IsAuthForCommissions(){ 退回货物; } public void setAuthForSalesContracts(布尔authForSalesContracts){ this.authForSalesContracts=authForSalesContracts; } 公共布尔值isAuthForSalesContracts(){ 退还销售合同; } public void setAuthForPurchaseContracts(布尔authForPurchaseContracts){ this.authForPurchaseContracts=authForPurchaseContracts; } 公共布尔值isAuthForPurchaseContracts(){ 返回authForPurchaseContracts; } } 以及相应的flex类:

package com.rekencentra.ifb.cfos.model.dto.security { [Bindable] [ExcludeClass] internal class AuthorisationThirdPartyBase extends BusinessObject { public var thirdParty:ThirdParty; public var otherThirdParty:ThirdParty; public var authForTemplates:Boolean; // missing ser. public var authForConsignments:Boolean; //missing ser. public var authForSalesContracts:Boolean; //missing ser. public var authForPurchaseContracts:Boolean; //missing ser. public var authValidFrom:Date; public var authValidTo:Date; } } package com.rekencentra.ifb.cfos.model.dto.security { [Bindable] [RemoteClass(alias="com.rekencentra.svc.cfos.model.security.AuthorisationThirdParty")] public class AuthorisationThirdParty extends AuthorisationThirdPartyBase { } } 包com.rekencentra.ifb.cfos.model.dto.security { [可装订] [不包括类别] 内部类授权ThirdPartyBase扩展了BusinessObject { 第三方:第三方; 第三方:第三方; public var authForTemplates:Boolean;//缺少ser。 public var authforCommissions:Boolean;//缺少ser。 public var authForSalesContracts:Boolean;//缺少ser。 public var authForPurchaseContracts:Boolean;//缺少ser。 公共var authValidFrom:日期; 公共var authValidTo:日期; } } 包com.rekencentra.ifb.cfos.model.dto.security { [可装订] [RemoteClass(别名=“com.rekencentra.svc.cfos.model.security.authorizationThirdParty”)] 公共类授权第三方扩展授权第三方基础 { } } 注意:为了方便起见,我省略了导入语句


我已经将blazeDS日志设置为debug和所有字段,但这些布尔值显示在输出中。接下来,我尝试了逐步完成序列化过程,但很容易在其中迷失方向

您的java类没有缺少字段的getter。如果要传递字段,serialiser需要获取这些字段。

您的java类没有缺少字段的getter。如果要传递字段,序列化程序需要获取这些字段。

可能无法识别“is”-方法?您应该尝试在“get”-方法中重命名它们。

可能无法识别“is”-方法?您应该尝试在“get”方法中重命名它们

public void setAuthForConsignments(Boolean authForConsignments) {
        this.authForConsignments = authForConsignments;
    }

    public boolean isAuthForConsignments() {
        return authForConsignments;
    }
 }
你能试着把setter改成primitive boolean吗?类型不一致:getter中的primitive和setter中的wrapper

即使private var设置为wrapper boolean,它也应该与设置为primitive boolean的getter和setter一起工作

但是,对于其他类型的情况,应该使用get和set对-包括字符串

你能试着把setter改成primitive boolean吗?类型不一致:getter中的primitive和setter中的wrapper

它应该在getter和setter都设置为primitiv的情况下工作