mark andrew
mark andrew

Reputation: 371

How to change the mapping for a map in Grails

The default mapping for a Map in Grails 2.0.0 only allows strings of less than 255 characters in the value field and I need more.

I could obviously change my Maps to a user-defined hasMany of key/value entities but I am porting a large project from 1.3.7 which has a lot of Maps and would like to solve the issue with one change.

I have read in two other StackOverflow questions (here and here) that to change this I need to "involve a custom handler for Hibernate for the HashMap type", but where and how exactly do I do this?

I have found nothing in the standard Grails docs.

Upvotes: 1

Views: 390

Answers (2)

Tomas Lin
Tomas Lin

Reputation: 3532

Have you tried applying a global database mapping? http://grails.org/doc/1.3.7/ref/Database%20Mapping/Usage.html

Upvotes: 1

Grooveek
Grooveek

Reputation: 10094

I think you'll have to cope with a custom UserType, as it's done in the Joda-Time plugin to handle Joda-Time types the same as Gorm types

You'll find an other example there

Upvotes: 0

Related Questions