gorm - Grails hasMany delete behavior -


i have 2 domain classes

class {    static hasmany = [ b : b ] }  class b {    static belongsto = } 

i keep cascading saves, when save a, updates b's, when delete of a, fail if b's exist associated a. have explicitly delete of b's first.

i'm not sure easiest way in grails. put check in before delete verify there no b's - simple enough. there way control through cascading or relationship behaviors don't have put logic in there?

specify cascade behavior collection

class {    static hasmany = [ b : b ]     static mapping = {         b cascade: 'save-update'     } } 

it cascade save , update not delete.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -