Re: How to remove items in a HasAndBelongsToMany

2010-06-08 Thread Mark Jensen
Yeah, I did try it.. did not work.. On Jun 8, 5:42 pm, Gauthier Segay wrote: > Cascading might be a solution, I've not used it for deleting orphans > so I can't say if this would solve your issue. > > Have you tried it with your mapping? > > On Jun 7, 11:40 pm, Mark Jensen wrote: > > > Thanks I

Re: How to remove items in a HasAndBelongsToMany

2010-06-08 Thread Gauthier Segay
Cascading might be a solution, I've not used it for deleting orphans so I can't say if this would solve your issue. Have you tried it with your mapping? On Jun 7, 11:40 pm, Mark Jensen wrote: > Thanks I look at it > > But I also found this.. > > http://api.castleproject.org/html/T_Castle_ActiveR

Re: How to remove items in a HasAndBelongsToMany

2010-06-07 Thread Mark Jensen
Thanks I look at it But I also found this.. http://api.castleproject.org/html/T_Castle_ActiveRecord_ManyRelationCascadeEnum.htm AllDeleteOrphan ... In additional to that, when an object is removed from the association and not associated with another object (orphaned), it will also be deleted.

Re: How to remove items in a HasAndBelongsToMany

2010-06-07 Thread Gauthier Segay
Hi Mark, I think the way to do this would be the same way doing this in plain sql, you would: - get a set of counts of product groups attached to the products attached to the product group you are looking to delete - delete every product where the count from previous set is 1 - delete the product

How to remove items in a HasAndBelongsToMany

2010-06-07 Thread Mark Jensen
Hi I got the following DB Setup Products - ID - Name ProductGroups - ID - Name Products_ProductGroups - ProductId - ProductGroupId If i delete an entire ProductGroup I dont want it to delete the products unless the products is not associated with another ProductGroup Any good way of doing thi