Just call .delete_! on the entity itself. It should automatically remove the 
relationships.

-------------------------------------
GA<[email protected]> wrote:

I would like to remove them from the database, not only the relationship.

How should I do that?

Thanks,


On Jan 5, 2010, at 9:42 PM, Naftoli Gugenheim wrote:

> Are they not getting removed from the collection when you call clear, or are 
> they not getting deleted in the database when you call save?
> Also, are you trying to delete the actual entity? Clear and remove just 
> delete the relationship.
> 
> -------------------------------------
> GA<[email protected]> wrote:
> 
> It does not work either with the LongKeyedMapper.
> 
> Am I doing something wrong?
> 
> 
> On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote:
> 
>> It was the first thing I tried. But it does not work.
>> 
>> I have run out of options now. I am going to try to add a LongKeyMapper to 
>> see if the problem gets solved.
>> 
>> 
>> 
>> On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote:
>> 
>>> Can you try
>>> entry.childEntries.clear
>>> entry.save
>>> ?
>>> 
>>> -------------------------------------
>>> GA<[email protected]> wrote:
>>> 
>>> Hello guys,
>>> 
>>> I have a table that has a many-to-many relationship with itself.
>>> 
>>> I manage to add new entries to the relationship table using the 
>>> MapperManyToMany, but I cannot remove entries.
>>> 
>>> This is the code I am using to remove:
>>> 
>>> for (entryToRemove <- entry.childEntries) {
>>> val indexOf = entry.childEntries.indexOf(entryToRemove)
>>> entry.childEntries.remove(indexOf)
>>> }
>>> entry.save
>>> 
>>> This code is supposed to remove all the entries in the relationship table, 
>>> but it does nothing.
>>> 
>>> The class I am using to define the ManyToMany table is an extension of 
>>> Mapper, not LongKeyedMapper. This is because I do not really need an extra 
>>> field just for the primary key. Could this be the problem?
>>> 
>>> Any suggestions?
>>> 
>>> Thanks in advance,
>>> 
>>> GA
>>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Lift" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/liftweb?hl=en.
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Lift" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/liftweb?hl=en.
>>> 
>>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Lift" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/liftweb?hl=en.
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/liftweb?hl=en.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to