开发者

How to set nvarchar to a table column in GORM

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)
}    

s开发者_运维技巧tatic 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜