Jim,
See inline... Jim Redman wrote: > > (Off Topic - either I'm going crazy, or the whole subscription to this > list starting at: http://www.castor.org/lists.html and including the > confirmation response does not mention the e-mail address of the list). ? the e-mail address is the same as the list name. You've obviously figured it out since you're mailing to the list. > > I'm trying to archive a graph of arbitrary objects. I don't know the > types of the object - they can be added by the user as they run the > application, so I can't create mappings up front or control the base > classes, etc. The objects are held in multiple wrappers and arrays - > that is there is a graph of objects, we may cross references. I seem > to get lots of copies of the objects and no references. > > As a trivial case, I created two Vectors of identical objects. The > Vectors are different, but contain the same object references. I > created a set/get for each Vector and a mapping for the root object > that maps the two fields (and only the two fields). I marshalled the > root object. The Vectors are stored, but with copies of the object > rather than a reference. Presumably if I unmarshall these the Vectors > will now no longer hold identical references, but copies of the > objects. Correct. Castor assumes objects are not references to objects contained elsewhere in the object model, unless otherwise declared via the mapping file. > > Is there anything that I need to do to force the creation of the > references? (Remember that I CANNOT create mappings for the objects in > the Vectors). Is Castor the right tool for this? In order to support references, you must mark the vector as a reference. <field name="objects" type="java.lang.Object" collection="vector"> <bind-xml reference="true"/> </field> You also must specify the identity field for the objects contained in the vector, so you will need a mapping for them. So no, Castor XML is not the tool for you if you are unable to tell Castor which field is the identity field because we don't support automatic IDs at this time. > > The real application is clearly much more complex than this. The graph > contains "wrapper" objects which again can contain references to > objects, that is, two different wrappers could reference the same > object. The Vectors will contain some identical references, but also > some differences. Even if my trivial sample case works, is there any > chance that these more complex cases will work? Castor doesn't support collections that are mixed with some reference and some non-reference values. --Keith ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
