Bruce, Thanks for your reply.
I removed setCustomer(Vector customers) (I had added it in an attempt to get things working). I used the source generator to create the code - the source generator created the addCustomer method, but it created a getCustomer which returned Customer[] instead of Vector - I replaced the generated code. It works fine without lazy instantiation. It does not work with lazy instantiation. I believe my code is structured exactly as in the myApp examples. I am using JBuilder5, if that makes any difference. Thanks again. craig -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 10:48 PM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] lazy instantiation of collections This one time, at band camp, Craig Johnson said: CJ>I'm having a problem with lazy instantion of a collection CJ> CJ>I have the following in my mapping file for a class called Reseller: CJ> CJ> <field name="customer" type="com.lextel.domain.Customer" CJ> collection="vector" lazy="true"> CJ> <sql many-key="CUST_RESELLER_ID"/> CJ> <bind-xml name="Customer" node="element" /> CJ> </field> CJ> CJ>This is my instance variable CJ> private java.util.Vector _customerList; CJ> CJ>I have the following for getters and setters CJ> CJ> public Vector getCustomer() CJ> { CJ> return _customerList; CJ> } //-- Vector getCustomers() CJ> CJ> public void setCustomer(Vector customers) CJ> { CJ> //-- copy collection CJ> _customerList.removeAllElements(); CJ> _customerList.addAll(customers); CJ> } //-- void setCustomer(Customer) CJ> CJ>I get the following exception: CJ> CJ>org.exolab.castor.jdo.DataObjectAccessException: no method to set value for CJ>field: com.lextel.domain.Customer in class: ClassMolder CJ>com.lextel.domain.Reseller CJ> CJ>This works fine without lazy instantiation. CJ> Craig, I notice that there is no adder for placing Customer objects into the Vector. I also notice that you're directly accessing the Vector using methods from java.util.Vector rather than an adder method. When you directly access the Vector in this manner, you're bypassing Castor completely. Take a look at the example objects in src/examples/myapp. The mapping for these objects is located in src/examples/jdo. They provide an example of exactly what you should be doing. Bruce -- perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
