6 Replies Latest reply on Sep 20, 2016 1:58 AM by jaikiran pai

    file.encoding for sql-load-script-source

    David Kireev Newbie

      Hi!

      I'm trying to use the sql-load-script-source property in persistence.xml but there is something wrong with file encoding.

      property - <property name="javax.persistence.sql-load-script-source" value="META-INF/load.sql"/>

      load.sql file's encoding is UTF-8 (it contains cyrillic and french characters)

      file.encoding system property was by default windows-1252 and that way (broken) it was written to DB (MySQL with table collation = utf8_general_ci)

      setting file.encoding to UTF-8 didn't help - file still was read with windows-1252 encoding

       

      I'm using WildFly 10.0.0.Final which uses by default Hibernate 5.0.7.

      I used debugger and dug into org.hibernate.jpa.internal.schemagen.ScriptSourceInputFromUrl.toReader which returned a reader (InputStreamReader) for load.sql with encoding got from Charset.defaultCharset() which in turn should have got it from file.encoding

       

      What am I missing? Is there any javax.persistence.* property to specify encoding of script files?