I'm using the ant hibernatetool and hbm2ddl tasks to generate the sql for creating tables from .hbm.xml files. I would like to set the charset of the generated tables to utf-8, so the last line of each create table command comes out something like:
In hibernate.cfg.xml, I have the dialect set to org.hibernate.dialect.MySQLInnoDBDialect, which gives me the 'type=InnoDB' part, but so far I haven't been able to find any help about setting the charset.
Is there an attribute I can add here, or a property I can set in the hibernate configuration file, that will cause hbm2ddl to output 'default charset=utf8" at the end of every 'create table' statement?
I'm using Hibernate 5.0.27 on Linux and 5.0.22-community on XP.
I don't know if you can do that in hibernate. But I can suggest some alternatives: 1. Try if there are any settings in the tool you use to convert the <hbm2ddl>. 2. While creating the Database you can set the default values for char Set.
CREATE DATABASE your_db_name [DEFAULT] CHARACTER SET utf8 [DEFAULT] COLLATE latin1_swedish_ci; 3. When you start the MySQL server try if you can start the server with default options for charset.
Ping back if none of this had worked.
If you are not laughing at yourself, then you just didn't get the joke.
I just had the craziest dream. This tiny ad was in it.
the new thread boost feature brings a LOT of attention to your favorite threads