Prevent Mass Assignment in Grails with Command Objects
Use Grails command objects as an allow-list for editable fields to prevent mass assignment and keep web input validation out of your domain model.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Use Grails command objects as an allow-list for editable fields to prevent mass assignment and keep web input validation out of your domain model.
Decide between lazy, eager select, and eager join fetching for Grails GORM hasMany associations while avoiding N+1 queries, duplicates, and pagination errors.
Use Grails GORM dynamic finders for simple CRUD lookups, but switch to Criteria or HQL for joins, aggregations, and reports to avoid runtime errors and N+1 queries.
Choosing between Hibernate and MongoDB GORM in Grails 6 shapes your data model, transactions, and scaling. This guide contrasts constraints, trade-offs, and a concrete side-by-side validation you can run today.
Compare dynamic finders, criteria API, and where queries in Grails GORM. Learn to avoid N+1, pick pagination strategies, and verify SQL with logging.
Grails 6 teams choosing between Where queries, Criteria API, and dynamic finders: Where queries win for new code with compile-time safety and composability, Criteria stays for advanced projections, dynamic finders only for trivial lookups.
Keep HTTP input out of GORM writes by validating command objects before service transactions, and verify rollback behavior in your Grails version.
Grails services are transactional by default, but @Transactional can be too coarse. GORM's withTransaction gives you programmatic control for conditional commits, nested logic, and retry scenarios—if you understand its rollback rules and nesting quirks.
Learn how Grails GORM dynamic finders let you replace boilerplate HQL with concise, readable service methods while understanding their limits and refactoring risks.