Quantcast

How can grail generate TEXT not LONGTEXT data type or column

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How can grail generate TEXT not LONGTEXT data type or column

khoivu
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can grail generate TEXT not LONGTEXT data type or column

Ian Roberts
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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can grail generate TEXT not LONGTEXT data type or column

Joel Richon
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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can grail generate TEXT not LONGTEXT data type or column

khoivu
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'
        }
       
       

}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can grail generate TEXT not LONGTEXT data type or column

Joel Richon
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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can grail generate TEXT not LONGTEXT data type or column

Jonathan Rosenberg
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


Loading...