AMF does support cyclical references, but I vaguely remember in Flex 1.5 there were some issues with references for typed objects inside Collection implementations that required translation. That is, the translation step on the server from AMF Array -> java.util.ArrayList -> java.util.Set (of typed objects).
 
As a long shot, can you try changing your childs property of your Parent to type ArrayList instead of Set to see if you can avoid this translation step issue with references?
 
(I'm still missing exactly whether you're saying that you've sent a single Child instance and it has a Parent instance that is uninitialized, or rather, is the default implementation.... or that you've sent a single Parent instance and each of the Child instances in the childs Set have invalid references to a Parent typed parent property).


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Valy Sivec
Sent: Tuesday, January 03, 2006 4:01 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex 1.5: AS2 serialization issue . Parent/Child data model implementation

Peter,

Here is the serverAPI,

public class Parent implements Serializable {

   private String property;
   private Set  childs;
  
   have here get/set methods
}


public class Child implements Serializable{

   private String property;
   private Parent parent;

   with get/set methods
}

I have a one-to-many relation between the Parent and the Child, implemented as "Set" on Parent. The "Child" has a reference back to the Parent via "parent"  property. I suspect AMF serialization doesn't work with cyclical reference. As I mentioned there is no problem sending Parent object from the client side to the server side.... but then I want to persist the "Child" object it looks that his "parent" property is like a new instance of the Parent class ( all Parent's properties are initialized with Java default values, in ! my case null;).

Is this an AMF limitation?.


I checked the object integrity logging the properties values to JBoss's log. Flex alert display the right value, but unfortunately don;t get the same value object on the server side.


Any suggestions?

Thanks,
Valy

Thank you,
Valy













Peter Farland <[EMAIL PROTECTED]> wrote:
Can we see the server API for these types too?
 
When you say a Child's parent property is empty, are you saying it is null on the server? What are you using to determine that?
 
 
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Valy Sivec
Sent: Tuesday, January 03, 2006 2:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 1.5: AS2 serialization issue . Parent/Child data model implementation

Hi Flexcoders,

I have a  master/detail data entry form and I have some difficulties transfering the data objects f! rom AS2 to the server side. The data persitence is implemented with Hibernate and I have a one to many relations between a Parent object and his  Child(s) objects.

Here is the AS2 implementation of the data model:


class Parent
{
  public static var regClass =    Object.registerClass("Parent", Parent);

  public var property : String;
  public var childs : Array = new Array();

  public function Parent() {}
}

class Child
{
  public static var regClass =    Object.registerClass("Child", Child);

  public var property : String;
  public var parent : Parent;

  public function Child() {}
}


Here is my problem: It looks that when I transfer the Child object from AS2! to Java via Remote Object call, the "parent" property is empty ( Parent's properties are initialized to the default values ) on the server side no matter ! what value I have on the AS2 side.  Is there any issue with the serialization from AS2 to JAVA in this case?.

I transfer the Parent object from AS2 to JAVA and everything is OK.

Thank you,
Valy





Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping


Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to