2014-10-29 59 views
0

執行帶有日語值的插入查詢時,將在MySQL工作臺中正常工作。 但是,當我從我的import.sql嘗試它時,這些字符看起來像是「????」在數據庫中。針對日文數據的Hibernate import.sql

<property name="hibernateProperties"> 
      <props> 
       <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>      
       <prop key="hibernate.hbm2ddl.auto">create</prop> 
       <prop key="hibernate.connection.characterEncoding">UTF-8</prop> 
       <prop key="hibernate.connection.useUnicode">true</prop> 
       <prop key="hibernate.connection.CharSet">UTF-8</prop> 
       <prop key="hibernate.hbm2ddl.import_files">/import.sql</prop> 
      </props> 
     </property> 

回答

0
<property name="hibernateProperties"> 
       <props> 
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>      
        <prop key="hibernate.hbm2ddl.auto">create</prop> 
        <prop key="hibernate.hbm2ddl.import_files">/import.sql</prop> 
       </props> 
      </property> 

,並使用URL連接爲

<property name="jdbcUrl" 
      value="jdbc:mysql://localhost:3306/test?autoConnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8" />