Home Grails UserType mapping with Gorm 6.1
Reply: 0

Grails UserType mapping with Gorm 6.1

HED
1#
HED Published in 2017-12-01 11:11:35Z

I'm having a problem with a mapping in Grails 3.3. I've created a custom type "PriceType" which uses two columns, amount and currency. I have a property of this type in a domain class and I get a "Cannot treat multi-column property as a single-column property" when I start up the application.

This is the mapping in the domain class:

@Entity
class PaymentClientsInformation {
    ...
    Price amount
    ...

    static constraints = {
        ...
        amount nullable: true
        ...
    }

    static mapping = {
        amount type: PriceType, {
            column name: 'PRICE_AMOUNT'
            column name: 'PRICE_CURRENCY'
        }
    }
}

and the sqlTypes of the type:

int[] sqlTypes() {
    [BigDecimalType.INSTANCE.sqlType(), StringType.INSTANCE.sqlType()]
}

Has anyone faced this problem? (edited)

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322459 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO