I’m using the SchemaExport utility with needsJdbc=false to generate a SQL Schema. The hibernate-hikaricp JAR is on the classpath because im generating the schema during a Maven build, using the following Java code:
final SchemaExport export = new SchemaExport();
export.doExecution(Action.CREATE, false, metadata, reg, new TargetDescriptorImpl(sql));
With 5.3.5.Final, the Hikari connection pool is initialized even though needsJdbc is false. This results in the following exception:
Caused by: org.hibernate.HibernateException: java.lang.IllegalArgumentException:
dataSource or dataSourceClassName or jdbcUrl is required.
at org.hibernate.hikaricp.internal.HikariCPConnectionProvider.configure (Hik
ariCPConnectionProvider.java:63)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configur
eService (StandardServiceRegistryImpl.java:100)
This used to work fine with 5.2.17.Final and we are getting this error only after upgrading to 5.3.5.Final.
Not sure I can agree with that. Why is Hibernate initializing the JDBC connection pool even though that useJdbc is false? In this use case there is no JDBC URL. I would dare to say that in this hase Hibernate is using Hikari in an improper manner. Therefore the exception
I didn’t write that part so I don’t have any idea what was the original purpose of that parameter.
Anyway, you need a database connection if you use the TargetType.DATABASE or if the action is update, so it’s not like setting that parameter to false will work for those two use cases.
If you can replicate your use case using this template, you should open a Jira issue to enhance the SchemaExport. We’ll have to analyze it afterward, and if the use case is valid, we could consider implementing it.