Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1
-
Fix Version/s: None
-
Component/s: Persistence
-
Labels:None
Description
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
For ex:
class MyDomain
{
static hasMany=[names:String]
}
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:
MyDomain.createCriteria {
names
}
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.
Issue Links
- is duplicated by
-
GRAILS-8044
Querying for collections of basic types
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
This may be blocked by http://opensource.atlassian.com/projects/hibernate/browse/HHH-869