Question

Squeryl provides functionality for declaration of database cascade mechanism. All you must to do is just invoke next methods:

relation_name.foreignKeyDeclaration.constrainReference(onDelete cascade) 

where relation_name is ie oneToManyRelation object. As a result it will generate constraint on database system level. It will works only if you use Schema.create mechanism to create ddl. In some cases you cannot change ddl, so you must implement cascade operation on app level.

Does squeryl provide mechanism that work on application level I mean when you invoke some delete operation squeryl automatically intercept such invocation and execute additional operations. I heard about callbacks but maybe there is better alternative (more declarative way)?

Was it helpful?

Solution

There is no declarative way to have Squeryl walk through your dependencies and delete related objects. I think that callbacks would be your best bet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top