Grails uses the ActiveRecord paradigm borrowed from Rails, so one can do something like:
Unlike Rails though, Grails uses Hibernate in the background, and unfortunately you can get yourself into a heap of Hibernate nastyness (like what happened to me) if your User object above isn't a persistent entity (ie. has no ID assigned to it). I found that the hard way after debugging deep into the Hibernate code yesterday =(new UserRole(user: user, role: role).save(flush: false, insert: true)
No comments:
Post a Comment