Question

I have a problem in Grails 1.1.2 + MySQL.

My domain class Something contains field

Map<String, Map<Integer, Integer>> priceMap

When I run the app, Grails creates table 'something' and sub-table 'something_price_map'. 'something_price_map' contains

BIGINT(20) price_map
VARCHAR(255) price_map_idx
TINYBLOB price_map_elt

The problem is that when I fill-in the column priceMap even with small map data like this 'priceMap:[en:[100:4, 500:20, 600:24]]', the size of the data exceeds the limit of 255bytes.

Is there any way of specifying maxSize constraint for the inner map (Map), so that Grails uses MEDIUMBLOB or BLOBK instead of TINYBLOB?

Btw... Using in-mem DB, everything works fine.

Was it helpful?

Solution

As you may know, there is a mapping constraint for a domain class. However, your issue may be too complex for that functionality.

In such cases, you can specify an explicit Hibernate mapping (via hbm file) for a domain class. This allows the complete flexibility of Hibernate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top