Hi Dave, > > Here's my very data structure: > > categoryId - int > name - varchar > parentId - int > > parentId is a recursive reference to categoryId > > Does anyone know how I would set up the class-descriptor for the > collection of children? > > Here's what I have: > > <class-descriptor > class="business.Category" > table="categories" > > > <field-descriptor id="1" > name="id" > column="categoryId" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > <field-descriptor id="2" > name="name" > column="NAME" > jdbc-type="VARCHAR" > /> > <collection-descriptor > name="subCategories" > element-class-ref="business.Category" > auto-delete="true" > > > <inverse-foreignkey field-ref="parentId"/> > </collection-descriptor> > > </class-descriptor>
You would need to add one more field-descriptor for the parentId field like so: <field-descriptor id="3" name="parentId" column="parentId" jdbc-type="INTEGER"/> I think you could also use anonymous fields in this case, but I haven't used them. There's a how-to in the xdocs in CVS, if you want to know more about that. > I'm not entirely sure what the inverse-foreignkey element means. The inverse-foreignkey element tells OJB the property(s) of the element-class-ref that "points" to elements of this class. Hope this helps, Randall --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
