0
votes

I'm using Flex 3.5, BlazeDS 3.2.0.3978 and EJB3 for backend. There are two RPC which are important to the problem. The first call will get a list of ThirdParty objects, this works fine. The second call happens when the user clicks on a ThirdParty, the details of this object (lazy collections) are retrieved. A single object is returned with most fields serialized. I say most, because for some reason, 4 boolean fields are not serialized and are put on false by flex by default.

Here is the 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;
    }
}

And the corresponding flex classes:

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 
    {
    }
}

Note: I have left out import statements for convenience.

I've set blazeDS logging to debug and all fields but these booleans are shown in the output. Next, I've tried stepping through the serialization process but it's fairly easy to get lost in there.

3

3 Answers

2
votes

Your java class doesn't have getters for the missing fields. The serialiser needs to get the fields if they are to be passed.

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

    public boolean isAuthForConsignments() {
        return authForConsignments;
    }
 }

Can you try changing the setter to primitive boolean? The types are inconsistent: primitive in the getter and wrapper in the setter.

It should work with both getter and setter set to primitive boolean even if the private var is set to wrapper Boolean.

For the case of other types however, you should use get and set pairings - including Strings.

0
votes

Maybe the 'is'-Methods are not recognized? You should try to rename them in 'get'-Methods.