views:

25

answers:

2

Hi,

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.

A: 

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

Gregor Kiddie
Great, this fixed it. I thought that a getter for a boolean could be isXXX following the javabean spec.
joeriMJ
A: 

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

splash