Question

I'm trying to increase the size of the encrypted column

static mapping = {
        col1  type: GormEncryptedStringType
}

static constraints = {
        col1(nullable:true)
}

It always generates a varchar(255) in MySQL while I want it as a text type. I tried adding maxSize:65000 but then it creates a varchar(65000) instead of text.

This field can contain a lot of data and ideally I would want it to be LONGTEXT field.

For other non-encypted fields, I successfully used type:'text' and it worked but I am stumped since this is an encrypted field and I cant add another type.

Any help is much appreciated.

Was it helpful?

Solution

Type is the Hibernate Type. In addition to that trying adding sqlType which as the name implies is the underlying SQL column type.

static mapping = {
        col1  type: GormEncryptedStringType, sqlType:'TEXT'
}

Also, depending on your 'sql type', you can also add length to change your column size

static mapping = {
        col1  type: GormEncryptedStringType, sqlType:'varchar', length:400
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top