If it is a Windows system, the default local character set of the system is gb2312. In order to make the data table also use the gb2312 character set, we need to write the SQL statement to create the data table like this:
Copy the code code as follows:
CREATE TABLE TEST
{
...
...
...
}default character set gb2312;
Then add: in hibernate.cfg.xml:
Copy the code code as follows:
<property name="connection.characterEncoding">gb2312</property>
If it is a Linux system, you only need to change the above gb2312 to UTF8.