mapper cascade delete

82 views
Skip to first unread message

tomer doron

unread,
Mar 9, 2011, 9:12:08 PM3/9/11
to Lift
i have a simple one to many relationship with cascade mixed it,
however, when deleting the parent item, the children are not deleted
and I am not able to undersand why. i did some other thread regarding
this topic, but could not figure out what the bottom line was.

here is how the relationship is defined.

on parent (CatalogItem):

object pearls extends MappedOneToMany(CatalogItemPearl,
CatalogItemPearl.catalogItem) with Owned[CatalogItemPearl] with
Cascade[CatalogItemPearl]

on child (CatalogItemPearl):

object catalogItem extends LongMappedMapper(this, CatalogItem)
{
override def dbColumnName = "catalog_item_id"
override def dbNotNull_? = true
}


Naftoli Gugenheim

unread,
Mar 10, 2011, 2:07:55 AM3/10/11
to lif...@googlegroups.com, tomer doron
Currently, you have to first "touch" the MappedOneToMany instance. Before writing "CatalogItem.delete_!" write "CatalogItem.pearls".
I have a fix, I just haven't had a chance to move forward with it yet.




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


tomer doron

unread,
Mar 21, 2011, 9:27:17 PM3/21/11
to Lift
thanks, i implemented this type of workaround and it works.

must say this is quite an important fix, the sooner it's in the trunk
the better...
Reply all
Reply to author
Forward
0 new messages