tags:

views:

36

answers:

1

How can I set the column's type to nvarchar(160)? I'm having a hard time making the sample code here relate to my target. I already tried this:

String text

static constraints = {
    text(size:1..160,blank:false)
}    

static mapping =  {
    text type: "nvarchar"
}

I'm encountering this error: Caused by: org.hibernate.MappingException: Could not determine type for: nvarchar, at table: twitter_status, for columns: [org.hibernate.mapping.Column(text)]

Finally, I'm using MySQL 5 for my database server.

Thanks in advance.

+1  A: 

MYSQL doesn't have an "NVARCHAR" type (iirc it's a SqlServer type), here are your choices - http://dev.mysql.com/doc/refman/5.0/en/string-types.html.

If you need unicode support you'll also need to make sure you're sending UTF-8 or UCS2 - http://dev.mysql.com/doc/refman/5.1/en/charset-applications.html

Dave
yeah, i think i'll just have to set the character set to UTF-8. basically, what we need is just unicode support. sorry, i just came from a mssql db from the previous project. thanks for the clarification.
firnnauriel