Affects Version/s: 1.2.1
Fix Version/s: None
Since a few versions ago, Grails has supported that a domain class has a collection of basic non-domain types
The GORM will create a related table as per http://jira.codehaus.org/browse/GRAILS-1023
Grails will create:
- a "my_domain" table for the main domain class
- a "my_domain_names" table with
- a "my_domain_id" foreign key pointing to "my_domain"
- a "names_string" column with the actual string
The GORM will provide the normal MyDomain.addToNames("...") methods, but WILL NOT provide dynamic methods to query MyDomain for certain names.
Also, there's no way with the criteria builders to do something like:
The only way to query for MyDomain's that have a certain name is, according to someone on the list, to use HQL:
def results = MyDomain.executeQuery('from MyDomain where :name in elements(names)', [name: "something"])
I think that collection of non-domain types should behave the same as domain associations with respect to persistence and querying.