Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Table character-set/collation using Hibernate Dialect?

I use Hibernate MySQLInnoDB Dialect to generate DDL's.

hibernate.cfg.xml :

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

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

like image 698
Ashika Umanga Umagiliya Avatar asked Dec 15 '09 09:12

Ashika Umanga Umagiliya


1 Answers

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.

like image 190
n002213f Avatar answered Nov 19 '22 23:11

n002213f