问题
I have A and B(a_id:Long)
entities.
B
depends on A
. So I've set constrainReference(onDelete cascade)
. Everything works fine.
But when I delete A
I want to free some resources depending on B
. Can somehow intercept B
's onDelete()
and perform operations then with a Squeryl way or I have to do it manually?
回答1:
In your Schema try:
override def callbacks = Seq(
afterDelete(table) call (record => logger.debug("afterDelete")))
来源:https://stackoverflow.com/questions/12512941/how-to-do-something-on-delete-in-squeryl