Sorry, I meant to post this to the mailing list. -doug
-----Original Message----- From: Deshpande, Anand To: 'Kvidera, Douglas' Sent: 6/14/2002 9:26 AM Subject: RE: [castor-dev] Hashtable/ HashMap Yes, this did help, thx. Regards Anand -----Original Message----- From: Kvidera, Douglas [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 9:04 AM To: Deshpande, Anand Subject: RE: [castor-dev] Hashtable/ HashMap Anand, If the object you want to map contains the key, you can do something like: class Parent { HashMap _children = new HashMap(); void addChild(Child c) { _children.put(c.getKey(), c); } Child getChild(Object key) { return (Child) _children.get(key); } Collection getChildren() { return _children.values(); } } and use the mapping: <class name="Parent" ...> <field name="children" type="Child" collection="collection" set-name="addChild" get-name="getChildren"> ... Please note that this will only work for Castor XML. Castor JDO seems to have a bug in that it can't use the mutator method defined in set-name. However, JDO works fine if you don't define it and let Castor find the mutator name by the field name (in this case, addChildren(Child)). Hope this helps. -doug -----Original Message----- From: Deshpande, Anand To: [EMAIL PROTECTED] Sent: 6/13/2002 3:42 PM Subject: [castor-dev] Hashtable/ HashMap Castor does not same the keys? Any update? Regards Anand ------------------------------------------------------------------------ ------ This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
