Jack -so the reference descriptor is not necessary in a 1-m ? ... you example below is a little confusing.
-is the child pk a foreign key also ? -on the Sku object... what is skuId ? did you mean this to be the "id" field ? also.. could you tell us what you do in code to actually add a Child object to the Sku object.. even pseudo code would do. j James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 2:07:33 PM >>> Thanks James & John - Here is the section: <class-descriptor class="c.w.b.m.Sku" table="SKU"> <field-descriptor name="id" column="PARENT" jdbc-type="CHAR" length="10" primarykey="true" nullable="false"/> <collection-descriptor element-class-ref="c.w.b.m.Child" name="children" orderby="childId" refresh="true" auto-retrieve="true" auto-update="true" auto-delete="true"> <inverse-foreignkey field-ref="skuId"/> </collection-descriptor> </class-descriptor> <class-descriptor class="c.w.b.m.Child" table="Child"> <field-descriptor name="parentId" jdbc-type="CHAR" column="PARENT" primarykey="true" length="10" nullable="false"/> <field-descriptor name="childId" jdbc-type="INTEGER" column="CHILDID" primarykey="true" nullable="false"/> <field-descriptor name="notes" jdbc-type="VARCHAR" column="NOTES" length="255" nullable="true"/> </class-descriptor> -----Original Message----- From: James Nyika [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 1:24 PM To: [EMAIL PROTECTED] Subject: RE: Changing contents of a 1:n Collection Doesn't Seem to Work Hi All, Yeah.. need to see that repository_user.xml I have been having this problem for a while too. I noticed that: if auto-delete and auto-update are set: 1. Creates always work fine.. if there are objects in the collection, then they are successfully created. 2. If you search for the newly created object, get the collection, add yet another new child object and attempt to store, it does not work. 3. Neither does doing the same in 2 except that you remove an existing child However, having said that, the following does work 1. Perform step 1 above. 2. Create a new child object and call store() on it alone. 3. Read the parent, object and voila! : it is magically in the collection. but this beats the whole point of using OJB. below is MY repository_user.xml (notice- i do not have a reference-descriptor in the child! do i need this ?) thanks ------------------------------------------------------------------------ ----------------------------------------------------------------- ------------------------------------------------------------descriptor start------------------------------------------------------------------- ---- <class-descriptor class="com.anasi.application.feecalculation.entities.OrderTO" table="ORDER"> <field-descriptor name="id" column="ID" jdbc-type="INTEGER" conversion="org.apache.ojb.broker.accesslayer.conversions.Int2IntegerFie ldConversion" primarykey="true" autoincrement="true"/> <field-descriptor name="orderState" column="ORDERSTATE" jdbc-type="INTEGER"/> <field-descriptor name="payerId" column="PAYER_ID" jdbc-type="BIGINT"/> <field-descriptor name="payeeId" column="PAYEE_ID" jdbc-type="BIGINT"/> <field-descriptor name="orderAmount" column="ORDERAMOUNT" jdbc-type="DOUBLE" precision="5" scale="2"/> <field-descriptor name="orderDate" column="ORDERDATE" jdbc-type="DATE" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa teFieldConversion"/> <collection-descriptor name="adjustments" element-class-ref="com.anasi.application.feecalculation.entities.Adjustm entTO" orderby="entryDate" sort="DESC" auto-retrieve="true" auto-update="true" auto-delete="true" refresh="true" > <inverse-foreignkey field-ref="orderId"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.anasi.application.feecalculation.entities.AdjustmentTO" table="ADJUSTMENT"> <field-descriptor name="id" column="ID" jdbc-type="INTEGER" conversion="org.apache.ojb.broker.accesslayer.conversions.Int2IntegerFie ldConversion" primarykey="true" autoincrement="true"/> <field-descriptor name="reasonId" column="REASON_ID" jdbc-type="BIGINT"/> <field-descriptor name="orderId" column="ORDER_ID" jdbc-type="INTEGER"/> <field-descriptor name="typeId" column="TYPE_ID" jdbc-type="BIGINT"/> <field-descriptor name="authCodeId" column="AUTH_CODE_ID" jdbc-type="BIGINT"/> <field-descriptor name="amount" column="AMOUNT" jdbc-type="DOUBLE" scale="2"/> <field-descriptor name="entryDate" column="ENTRY_DATE" jdbc-type="DATE" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa teFieldConversion"/> <field-descriptor name="effectiveDate" column="EFFECTIVE_DATE" jdbc-type="DATE" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa teFieldConversion"/> <field-descriptor name="expirationDate" column="EXPIRATION_DATE" jdbc-type="DATE" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa teFieldConversion"/> </class-descriptor> ------------------------------------------------------------descriptor end--------------------------------------------------------------------- -- James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 12:33:33 PM >>> post your repository_user.xml do you have auto-delete=true and auto-update= true on your collection-descriptor? -----Original Message----- From: Jack Collins [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: Changing contents of a 1:n Collection Doesn't Seem to Work I have an object that has a collection as one of its properties. I can create the object, add members to the collection and save it with no problem. If I check the contents of the database I see the parent object and all of its children. If I retrieve that same object and remove one of the child objects in the collection and save the parent again, the changes to the collection are not reflected in the database. It seems like OJB is only capable of adding to the contents of a collection but not removing them. When I turned on the logging of the SqlGeneratorDefaultImpl I can see insert and update statements, but never a delete statement to handle the removal of the child from the collection. I am using RC3 and have tried using a few different cache implementations (ObjectCachePerBrokerImpl, ObjectCacheDefaultImpl, ObjectCacheEmptyImpl) but always get the same result. What am I missing? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]