使用休眠方言设置表字符集/排序规则? [英] Set Table character-set/collation using Hibernate Dialect?

查看:69
本文介绍了使用休眠方言设置表字符集/排序规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Hibernate MySQLInnoDB方言生成DDL.

I use Hibernate MySQLInnoDB Dialect to generate DDL's.

hibernate.cfg.xml:

hibernate.cfg.xml :

<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

如何为生成的表将字符集/排序规则配置为'utf8_general_ci'?

How can I configure the character-set/Collation to 'utf8_general_ci' for the generated table?

推荐答案

我之前有相同的要求,并使用了详细的解决方案.您需要子类 MySQLInnoDBDialect ,并覆盖 getTableTypeString 方法.文章中有更多内容.

I had the same requirement before and used this article which provides the solutions in great detail. You need to subclass MySQLInnoDBDialect and override the getTableTypeString method. More in the article.

这篇关于使用休眠方言设置表字符集/排序规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆