Grails
  1. Grails
  2. GRAILS-1905

book-flow sample tries to create a table called order in the in-memory hsqldb - this is a reserve word

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0-RC2
    • Fix Version/s: 2.1.4
    • Component/s: Documentation
    • Labels:
      None

      Description

      The domain class 'Order' results in an attempt create a table called 'order', since this is a reserve word this fails (org."hibernate.tool.hbm2ddl"="debug,stdout"):

      Unsuccessful: create table order (id bigint generated by default as identity (start with 1), version bigint not null, in
      voice_number varchar(255) not null, payment_details_card_number varchar(255) not null, payment_details_expiry_date varch
      ar(255) not null, person_id bigint, shipping_address_number varchar(255) not null, shipping_address_post_code varchar(25
      5) not null, primary key (id))
      Unexpected token: ORDER in statement [create table order]

      I suggest that this domain object be renamed to 'Orders' which solves the problem.

        Activity

        Hide
        Graeme Rocher added a comment -

        Assigning all documentation related issues to 1.2 final since they don't represent a change to the codebase

        Show
        Graeme Rocher added a comment - Assigning all documentation related issues to 1.2 final since they don't represent a change to the codebase
        Hide
        Alexander Zeillinger added a comment -

        Is there an up-to-date sample of this? If not this might as well get closed.

        Show
        Alexander Zeillinger added a comment - Is there an up-to-date sample of this? If not this might as well get closed.
        Hide
        Bobby Warner added a comment -

        This is not a valid issue with Grails anymore. The solution for avoiding issues with reserved words in table names is to leverage "mapping" in any particular domain class:

        http://grails.org/doc/latest/ref/Domain%20Classes/mapping.html

        Show
        Bobby Warner added a comment - This is not a valid issue with Grails anymore. The solution for avoiding issues with reserved words in table names is to leverage "mapping" in any particular domain class: http://grails.org/doc/latest/ref/Domain%20Classes/mapping.html

          People

          • Assignee:
            Bobby Warner
            Reporter:
            Chris Borrill
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development