Eclipselink automatically creates utf8_unicode_ci

When I launch my application, eclipselink is set to automatically delete and creates a table in the database. I installed it to create the InnoDB mechanism using the table creation suffix. However, I would like the text encoding to be utf8_unicode_ci. How to configure xml file for this. Currently, utf8_general_ci is used by default.

<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSc...>
  <persistence-unit name="Data">

    <class>com.core.objects.StandardObject</class>

    <properties>
     <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
     <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/data" />
     <property name="javax.persistence.jdbc.user" value="username" />
     <property name="javax.persistence.jdbc.password" value="password" />

     <!-- EclipseLink should create the database schema automatically -->
     <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
     <property name="eclipselink.ddl-generation.output-mode" value="database" />
     <property name="eclipselink.ddl-generation.table-creation-suffix" value="engine=InnoDB " />
    </properties>
  </persistence-unit>
</persistence>
+4
source share
2 answers

It has been a while since you asked this question, anyway, I send this answer by accident if someone wants to know.

Change the value of the "javax.persistence.jdbc.url" property from

"jdbc:mysql://localhost:3306/data"

to

"jdbc:mysql://localhost:3306/data?useUnicode=yes&amp;characterEncoding=UTF-8".

.
, ;)

+4

, :

<prop key=eclipselink.ddl-generation.table-creation-suffix>ENGINE=InnoDB DEFAULT CHARSET=utf8</prop>
0

All Articles