Hi Folks,
I've re-read the following page:
http://jakarta.apache.org/ojb/tutorial3.html#setting%20load-,%20update-%
20and%20delete-cascading
Should there be any reason why I should not expect load-cascading to
load an _entire_ object graph?
For example, I have an Order class, with a collection of OrderDetails,
and each OrderDetail contains an Item. Loading the Order object
populates the OrderDetail collection, however none of the OrderDetail
objects have an Item (null) when I retrieve the order.
Here's a snippet from my class:
Order order = new OrderBean();
order.setId(Integer.parseInt(orderid));
Query query = new QueryByExample(order);
order = (Order) broker.getObjectByQuery(query);
Here's a snippet from my repository.xml:
<class-descriptor class="com.eieifood.entity.OrderBean" table="orders">
<field-descriptor id="1" name="id" column="id"
jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<field-descriptor id="2" name="active" column="active"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToBooleanFieldConversion"/>
<field-descriptor id="3" name="date" column="date"
jdbc-type="DATE"/>
<field-descriptor id="4" name="deliverydate"
column="deliverydate" jdbc-type="TIMESTAMP"/>
<field-descriptor id="5" name="deliverycharge"
column="deliverycharge" jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="6" name="credits" column="credits"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="7" name="memberId" column="memberid"
jdbc-type="VARCHAR"/>
<reference-descriptor name="member"
class-ref="com.eieifood.entity.UserBean" auto-retrieve="true">
<foreignkey field-id-ref="7"/>
</reference-descriptor>
<collection-descriptor name="details"
element-class-ref="com.eieifood.entity.OrderDetailBean" refresh="true"
auto-retrieve="true">
<inverse-foreignkey field-id-ref="4"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="com.eieifood.entity.OrderDetailBean"
table="orderdetails">
<field-descriptor id="1" name="id" column="id"
jdbc-type="VARCHAR" primarykey="true" autoincrement="true"/>
<field-descriptor id="2" name="quantity" column="quantity"
jdbc-type="INTEGER"/>
<field-descriptor id="3" name="price" column="price"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="4" name="orderId" column="orderid"
jdbc-type="INTEGER"/>
<field-descriptor id="5" name="itemId" column="itemid"
jdbc-type="VARCHAR"/>
<reference-descriptor name="order"
class-ref="com.eieifood.entity.OrderBean" auto-retrieve="true">
<foreignkey field-id-ref="4"/>
</reference-descriptor>
<reference-descriptor name="item"
class-ref="com.eieifood.entity.ItemBean" auto-retrieve="true">
<foreignkey field-id-ref="5"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor class="com.eieifood.entity.ItemBean" table="items">
<field-descriptor id="1" name="id" column="id"
jdbc-type="VARCHAR" primarykey="true" autoincrement="true"/>
<field-descriptor id="2" name="active" column="active"
jdbc-type="INTEGER"/>
<field-descriptor id="3" name="name" column="name"
jdbc-type="VARCHAR"/>
<field-descriptor id="4" name="upc" column="upc"
jdbc-type="VARCHAR"/>
<field-descriptor id="5" name="taxes" column="taxes"
jdbc-type="VARCHAR"/>
<field-descriptor id="6" name="size" column="size"
jdbc-type="VARCHAR"/>
<field-descriptor id="7" name="costprice" column="costprice"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="8" name="price" column="price"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="9" name="saleprice" column="saleprice"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToDoubleFieldConversion"/>
<field-descriptor id="10" name="details" column="details"
jdbc-type="VARCHAR"/>
<field-descriptor id="11" name="notes" column="notes"
jdbc-type="VARCHAR"/>
<field-descriptor id="12" name="position" column="position"
jdbc-type="VARCHAR"/>
<field-descriptor id="13" name="maxquantity"
column="maxquantity" jdbc-type="INTEGER"/>
<field-descriptor id="14" name="haspicture" column="haspicture"
jdbc-type="VARCHAR"
conversion="com.eieifood.util.StringToBooleanFieldConversion"/>
<collection-descriptor name="categories"
element-class-ref="com.eieifood.entity.CategoryBean"
auto-retrieve="true" indirection-table="item_categories">
<fk-pointing-to-this-class column="item_id"/>
<fk-pointing-to-element-class column="category_id"/>
</collection-descriptor>
</class-descriptor>
Am I missing something?
Steve
--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>