Reputation: 4063
I need to create a domain class and I want to do a field there with ArrayList<String>
type. But when I open a db-table, I can't find new field with ArrayList<String>
type. It's impossible to create. But I can add to db-table a new field with String
-type instead of ArrayList<String>
. Where is cause? And which type of collection can I use instead of ArrayList<String>
to I can successfully use it in domain class?
Upvotes: 0
Views: 126
Reputation: 133
Unless you are using a nosql database, you will simply create another table. In my example below, you would end up with two tables in the database... test and test_a. If you are using a nosql DB then you would get one document with an embedded list.
class Test {
List<String> a
static hasMany = [
a: String
]
}
Upvotes: 1