First, I find it hard to find easily browsable resources (the documentation is very raw,
and the tutorials are spread out and only show 'hello world' types of examples ).
In my opinion the documentation is great, perhaps we're using different docs. I use:
If that still isn't satisfactory, I highly recommend the book "The Definitive Guide to Grails". I believe "Grails in Action" is also very good, but haven't read it. For learning Groovy, "Programming Groovy" is a great book (albeit a little out of date).
In my controller, I am getting a category id and a procedure id as parameters, and I am
trying to get the ShopCategoryPage associated with those parameters.
The easiest way (though not the most efficient) is to use the dynamic finders.
// First of all load the ProductProcedure and ProductCategory
// I'm assuming here the request params are named 'procedureId' and 'categoryId'
ProductProcedure productProcedure = ProductProcedure.get(params.procedureId.toLong())
ProductCategory productCategory = ProductCategory .get(params.categoryId.toLong())
// Now get the ShopCategoryPage associated with these. Replace 'find' with 'findAll'
// if there could be multiple associated ShopCategoryPages
ShopCategoryPage shopCategoryPage = ShopCategoryPage.findByProcedureAndCategory(productProcedure, productCategory)
A shortcoming of this approach is that it will cause 3 SELECT statements to be executed. If you're only interested in the shopCategoryPage returned by the last query, you could load this in "one shot" using HQL or a criteria query instead.