Each Java class needs to be serialized from ActionScript.  Right now,
this means exposing all properties using public get/set methods or with
a public field.  Without a setter, it is hard to know exactly what field
to set when we deserialize a class.  

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of chris_alme
Sent: Tuesday, December 11, 2007 7:46 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataServiceTransaction auto-refresh issue

 

I've found a solution to this!!! Though I am a bit puzzled and would
love to get more input on this... 

I noticed in the LCDS log that the "identity" specified in
data-management-config.xml: 

 
<destination id="messageService">
    <adapter ref="java-dao">
    <properties>
        <source>messageAssembler</source>
        <scope>application</scope>
        <factory>spring</factory>
        <metadata>
            <identity property="id" type="java.lang.Integer" />
        </metadata>
    </properties> 
    </adapter>
</destination>

of the managed object sent to the client was coming back as null (see:
{id=null}):

 
[Flex] 12/11/2007 09:02:11.461 [DEBUG] [Message.Data.page_items] Before
invoke service: data-service
  incomingMessage: Flex Message (flex.data.messages.DataMessage) 
    operation = page_items
    id = null
    clientId = 53492C9B-48AD-96DB-8C56-C9B9B8F61CB3
    correlationId = 
    destination = messageService
    messageId = CE15E11D-7D0A-9BEC-EDB0-C9BA32DC7D6B
    timestamp = 1197385331461
    timeToLive = 0
    body = {}
    hdr(DSEndpoint) = clario-amf-polling
    hdr(sequenceId) = 1
    hdr(DSids) = 
      [
        {id=null}
      ]
    hdr(DSId) = A27E7099-4D18-5A3A-B7AD-71EBEFFF9EA1

Long story short, the "id" property of my server-side object was NOT
writable. This is intended as it ties to the DB identity and is either
set during construction or via hibernate during insert/retrieval to/from
the DB. 
I changed the "setId()" method to public, and everything works fine -
updates are pushed to the client and my DataGrid updates accordingly. 

Though I question why this has to be writable? I want it to be read-only
to prevent tampering. Why must it be writable??? 

According to the Live Cycle docs: 
A Data Management Service destination contains one or more identity
elements that you can use to designate data properties to be used to
guarantee unique identity among items in a collection of data. 
So as long as I set the identity, shouldn't LCDS need only the ability
to read it for comparison purposes??? I know it is getting set properly
as I can debug and see it prior to serialization. 
Thoughts??? 

 

Reply via email to