Reputation: 33
I have a parent domain class, Product:
class Product {
...
}
and more than 20 child classes extending it. One of this is ProductGroup:
class ProductGroup extends Product {
...
}
When creating an instance of ProductGroup, I have a multiselect input where products are listed and a user can select what products he/she wants to add to the group. Right now, I use Product.list() to populate the multiselect input. What I want to do is have a list of all products not including ProductGroup instances. What would be the best way to do this?
Upvotes: 1
Views: 335
Reputation: 122364
You should be able to do this with HQL if not with native GORM:
Product.findAll("from Product p where p.class != ProductGroup")
Upvotes: 1