1
0
mirror of https://github.com/google/nomulus synced 2026-01-11 00:10:36 +00:00

Fix missing-driver in HibernateSchemaExporterTest (#777)

* Fix missing-driver in HibernateSchemaExporterTest

HibernateSchemaExporterTest is failing with "Driver not found" error
after Java 11 upgrade. Reason is that ServiceLoader now only checks
modules for services.

Proper fix is to define modules.

This short term fix is to declare the driver class explicitly.
This commit is contained in:
Weimin Yu
2020-08-24 10:20:19 -04:00
committed by GitHub
parent 8d38086d40
commit c36f0c89c8

View File

@@ -59,6 +59,9 @@ public class HibernateSchemaExporter {
settings.put(Environment.USER, username);
settings.put(Environment.PASS, password);
settings.put(Environment.HBM2DDL_AUTO, "none");
// Register driver explicitly to work around ServiceLoader change after Java 8.
// Driver self-registration only works if driver is declared in a module.
settings.put(Environment.DRIVER, "org.postgresql.Driver");
settings.put(Environment.SHOW_SQL, "true");
settings.put(
Environment.PHYSICAL_NAMING_STRATEGY, NomulusNamingStrategy.class.getCanonicalName());