Is this a bug of grails when map the GORM class to SQL DDL

9 views
Skip to first unread message

javacha...@gmail.com

unread,
Sep 8, 2016, 11:07:05 PM9/8/16
to Grails Dev Discuss
This is my grails version:

| Grails Version: 3.1.6
| Groovy Version: 2.4.6
| JVM Version: 1.8.0_51

I am running the code on Windows.

This is the domain class

package wxserver

class Test {

String sort
static mapping = {
version false
sort column: "SORT"
}
static constraints = {
}
}


the log shows the generated SQL DDL 

Hibernate: create table Test (id bigint not null auto_increment, sort varchar(255) not null, primary key (id)) ENGINE=InnoDB

As you can see, I hope the column be uppercase, but in fact, the column is mapped to "sort", if I changed the Test property sort to "_sort" or "mSort", the DDL is correct? 

Is this a bug?

javacha...@gmail.com

unread,
Sep 8, 2016, 11:08:23 PM9/8/16
to Grails Dev Discuss


在 2016年9月9日星期五 UTC+8上午11:07:05,javacha...@gmail.com写道:
As you can see, I hope the column be uppercase, but in fact, the column is mapped to "sort", if I changed the Test property sort to "_sort" or "mSort", the DDL is mapped correct.

Is this a bug?

Søren Berg Glasius

unread,
Sep 9, 2016, 12:10:04 PM9/9/16
to grails-de...@googlegroups.com, javacha...@gmail.com
Hi,

No, but `SORT` is a keyword in most SQL databases.

Try changing your mapping to 

sort column: "SORTED" 

or something like that

Best regards,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/d2f213bc-269d-4ed8-8a94-9588284261bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages