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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

javacharlie2016
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?

--
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 [hidden email].
To post to this group, send email to [hidden email].
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

javacharlie2016


在 2016年9月9日星期五 UTC+8上午11:07:05,javacha...@gmail.com写道:
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 mapped correct.

Is this a bug?

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/ddb2077e-64d2-4ffc-9a9e-79b965c6f4b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

sbglasius
In reply to this post by javacharlie2016
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.

From: [hidden email] [hidden email]
Reply: [hidden email] [hidden email]
Date: 9. september 2016 at 05.07.07
To: Grails Dev Discuss [hidden email]
Subject:  Is this a bug of grails when map the GORM class to SQL DDL

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?

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAGY%2BWWSzzxhfvGftv8PpmW5hHCODu1wjojaRTsUZ1q5BT2EFKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...