Announcement Announcement Module
Collapse
No announcement yet.
MySQL: Reserved SQL keyword 'State' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL: Reserved SQL keyword 'State'

    I'm trying to recreate an existing application is Roo 1.1. I'm using Hibernate / MySQL for persistence. When I try to create the following entity, I get an exception:

    Code:
    entity --class ~.domain.State --testAutomatically
    Reserved SQL keyword 'State' is not permitted as simple type name
    Code:
    entity --class ~.domain.User --testAutomatically
    Reserved SQL keyword 'User' is not permitted as simple type name
    I've used "State" and "User" in MySQL databases before with no issues.

    According to the MySQL Reserved Word list, 'State' is not a reserved word, however it is for MSSQL.
    MySQL 5.5 Reserved words

    Any idea how to get around this?

    Bill
    Last edited by wistephens; May 31st, 2011, 08:21 AM.

  • #2
    Just add the "permitReservedWords" option to the relevant command(s), e.g.

    Code:
    entity --class com.example.foo.domain.User --permitReservedWords
    field string --fieldName state --permitReservedWords

    Comment


    • #3
      Originally posted by Andrew Swan View Post
      Just add the "permitReservedWords" option to the relevant command(s), e.g.

      Code:
      entity --class com.example.foo.domain.User --permitReservedWords
      field string --fieldName state --permitReservedWords
      I met similar problem, when using "--permitReservedWords", the roo script can run successfully, while when deploy to tomcat, the corresponding mysql tables can not be created, and with below error:
      2011-07-28 10:03:31,937 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Y
      ou have an error in your SQL syntax; check the manual that corresponds to your M
      ySQL server version for the right syntax to use near 'desc varchar(255), detail_
      url varchar(255)' at line 1


      How to correct this error? Thanks!

      Comment


      • #4
        I found even if I manually created the table on mysql, when running the insert operation via spring roo generated pages (index.jsp, etc), will get insert error...
        Since I have many tables, and I know if I use "`desc`" in mysql table, it will just work... How to resolve such issue? Thanks in advance!

        Comment


        • #5
          Any expert can help? Urgent help is needed ...

          Comment

          Working...
          X