I have a strange problem.
I have two domain classes User
and Post
with fields:
class User {
String name
static hasMany = [pos
You can prevent this by explicitly declaring your collection property (with a value) alongside your mapping:
class User {
String name
Set posts = []
static hasMany = [posts: Post]
}
You can define the collection type you need. The default is Set
, but if you need to maintain order, you might consider List
or SortedSet
.