Announcement Announcement Module
Collapse
No announcement yet.
Indexed list in domain class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Indexed list in domain class

    I have two domain model classes:
    class Race {
    List registrations
    static hasMany = [registrations: Registration]
    }

    class Registration {
    static belongsTo = [race: Race]
    }

    Grails created for me two databases:
    CREATE TABLE `race` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `version` bigint(20) NOT NULL,
    PRIMARY KEY (`id`)
    )

    CREATE TABLE `transport`.`registration` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `version` bigint(20) NOT NULL,
    `race_id` bigint(20) NOT NULL,
    `registrations_idx` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `FKAF83E8B958808C8F` (`race_id`)
    )

    I read a lot of info about GORM but didn't find how to map list to indexed column that I can provide(like @IndexedColumn in Hibernate), not automatic generated. I need to use my own index column. How it can be realized in Grails?

  • #2
    Of course Grails can do this
    Just take a look at this section in the Grails Reference:
    http://grails.org/doc/latest/ref/Dat...dexColumn.html

    Comment


    • #3
      Thanks a lot

      Comment

      Working...
      X