|
I have this database mapping
static mapping = { fulldescription column: "longDescripition", type: "text", nullable:true } Grail 2.1.0 generates the column longDescription as LongText in my MySql database. What is the right syntax to make grail generates a text column? Thanks ~K |
|
On 23/07/2012 19:43, khoivu wrote:
> I have this database mapping > > > static mapping = { > fulldescription column: "longDescripition", type: "text", nullable:true > } > Grail 2.1.0 generates the column longDescription as LongText in my MySql > database. What is the right syntax to make grail generates a text column? What happens if you add a maxSize constraint (set to a value that's greater than 255 but short enough to fit in a text column)? Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by khoivu
The keyword you want is sqlType. For example:
fulldescription column: "longDescripition", sqlType: "text", nullable:true Cheers Joel On 7/23/2012 2:43 PM, khoivu wrote: > I have this database mapping > > > static mapping = { > fulldescription column: "longDescripition", type: "text", nullable:true > } > Grail 2.1.0 generates the column longDescription as LongText in my MySql > database. What is the right syntax to make grail generates a text column? > > Thanks > > ~K > > > > > -- > View this message in context: http://grails.1312388.n4.nabble.com/How-can-grail-generate-TEXT-not-LONGTEXT-data-type-or-column-tp4632061.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I have tried sqlType:'text' but it does not work. I have also tried combination of type and size as below, but it does not work either.
class Assign { static constraints = { prop column:'property', nullable:true, size:0..30 lookupValue column:'lookupvalue', nullable:true, size:0..65353 } static mapping = { table 'assign' lookupValue type:'text' } } |
|
Seems to work for me. The class definition I used:
class Assign { String prop String lookupValue static constraints = { prop column:'property', nullable:true, size:0..30 lookupValue column:'lookupvalue', nullable:true, size:0..65353 } static mapping = { table 'assign' lookupValue sqlType:'text' } } generates the following schema: create table assign (id bigint not null auto_increment, version bigint not null, lookup_value text, prop varchar(30), primary key (id)); and I verified the table is created correctly in mySql. Cheers Joel On 7/25/2012 3:38 PM, khoivu wrote: > I have tried sqlType:'text' but it does not work. I have also tried > combination of type and size as below, but it does not work either. > > > class Assign { > > static constraints = { > prop column:'property', nullable:true, size:0..30 > lookupValue column:'lookupvalue', nullable:true, size:0..65353 > } > > static mapping = { > table 'assign' > lookupValue type:'text' > } > > > > } > > > > > -- > View this message in context: http://grails.1312388.n4.nabble.com/How-can-grail-generate-TEXT-not-LONGTEXT-data-type-or-column-tp4632061p4632233.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by khoivu
Try
sqlType:'longtext' -- Jonathan Rosenberg Founder & Executive Director Tabby's Place, a Cat Sanctuary http://www.tabbysplace.org/ On Wed, Jul 25, 2012 at 3:38 PM, khoivu <[hidden email]> wrote: > I have tried sqlType:'text' but it does not work. I have also tried > combination of type and size as below, but it does not work either. > > > class Assign { > > static constraints = { > prop column:'property', nullable:true, size:0..30 > lookupValue column:'lookupvalue', nullable:true, size:0..65353 > } > > static mapping = { > table 'assign' > lookupValue type:'text' > } > > > > } > > > > > -- > View this message in context: http://grails.1312388.n4.nabble.com/How-can-grail-generate-TEXT-not-LONGTEXT-data-type-or-column-tp4632061p4632233.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
