Skip to content

Commit

Permalink
Add DDL charset support for import.sql file
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed May 25, 2020
1 parent 08c30ea commit ee21ece
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.hibernate.orm.deployment;

import java.nio.charset.Charset;
import java.time.Duration;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -75,6 +76,12 @@ public class HibernateOrmConfig {
@ConfigItem(defaultValueDocumentation = "import.sql in DEV, TEST ; no-file otherwise")
public Optional<String> sqlLoadScript;

/**
* The name of the charset used by the schema generation resource. Without specifying this configuration property, the JVM default charset is used.
*/
@ConfigItem(defaultValueDocumentation = "JVM default charset")
public Optional<String> ddlCharset;

/**
* The size of the batches used when loading entities and collections.
*
Expand Down Expand Up @@ -181,6 +188,7 @@ public boolean isAnyPropertySet() {
return dialect.isPresent() ||
dialectStorageEngine.isPresent() ||
sqlLoadScript.isPresent() ||
ddlCharset.isPresent() ||
batchFetchSize > 0 ||
statistics.isPresent() ||
query.isAnyPropertySet() ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ private void handleHibernateORMWithNoPersistenceXml(
desc.getProperties().setProperty(AvailableSettings.GENERATE_STATISTICS, "true");
}

if (hibernateConfig.ddlCharset.isPresent()) {
desc.getProperties().setProperty(AvailableSettings.HBM2DDL_CHARSET_NAME, hibernateConfig.ddlCharset.get());
}

// sql-load-script
Optional<String> importFile = getSqlLoadScript(launchMode);

Expand Down

0 comments on commit ee21ece

Please sign in to comment.