Grails

Domain and controller with name 'group' doesn't wor.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.0.1
  • Fix Version/s: 1.0.2
  • Component/s: None
  • Labels:
    None
  • Environment:
    Vista JDK 1.6

Description

Scaffolding on Domain and Controller with name "group" (Group and GroupController) doesn't work.
If i change name from "group" to "group1" for example, it works.

TestCase:
1. Create domain and controller classes.

GroupController.groovy
class GroupController {
	def scaffold = true
}

{code:title=Group.groovy}
class Group {
	int i
}

2. Go-to ".../group/list" url.

Result:

Caused by: java.sql.SQLException: Unexpected token: 
GROUP in statement [select top ? this_.id 
as id1_0_, this_.version as version1_0_, 
this_.i as i1_0_ from group this_]

Cause:
Probably the cause is that table "GROUP" has not been created. I looked at the db creation script, and there is no command for creating "GROUP" table.

Activity

Hide
Tobias Niehus added a comment -

Probably your're using a SQL key word. 'Group' is a reserved sql key word in MySQL for instance.

Show
Tobias Niehus added a comment - Probably your're using a SQL key word. 'Group' is a reserved sql key word in MySQL for instance.
Hide
Graeme Rocher added a comment -

group is a sql keyword which your domain class name clashes with, you can work around this by changing your mapping and using back tick quotes:

static mapping = {
    table "`group`"
}
Show
Graeme Rocher added a comment - group is a sql keyword which your domain class name clashes with, you can work around this by changing your mapping and using back tick quotes:
static mapping = {
    table "`group`"
}

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: