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