Howes
Howes

Reputation: 819

Grails static mapping for String[]

I am trying to store a string[] in a database with grails but tinyblob isn't large enough. I've tried changing the mapping to blob and longblob but when I do this I get an error:

[Ljava.lang.String; cannot be cast to java.sql.Blob  

Next I tried changing the maxSize within the domain constraints but I get the error

No such property: maxSize for class:

Any ideas on how to get this to work?

Upvotes: 0

Views: 672

Answers (2)

John Gordon
John Gordon

Reputation: 2201

A blob is not a string array, it is a byte array, byte[]. Try changing the string to a byte array and persist it in that form.

Upvotes: 0

Kelly
Kelly

Reputation: 3709

I'm curious about your reasoning for doing this. If you are just trying to have many string associated to a domain class you can do that directly like this:

    static hasMany = [whatevers: String]

Upvotes: 1

Related Questions