Offline DDL generation with Hibernate 5.3

Hi All

I am using hibernate 5.2 on a project and we generate our DDL scripts offline (not connected to any database) using hibernate tools. We use hbm2ddl ant task through Gradle.

This works great and our hibernate.cfg.xml for that purpose looks like:

<hibernate-configuration>
    <session-factory>
        <property name="dialect">org.hibernate.dialect.PostgreSQL9Dialect</property>
        <mapping class=my.first.jpa.Entity/>
        <mapping class=my.second.jpa.Entity/>
        ...
    </session-factory>
</hibernate-configuration>

However when upgrading to hibernate 5.3 it seems that hibernate now requires a database connection to produce the same DDL. My working 5.2 configuration gives me an org.hibernate.HibernateException: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required. with 5.3.

Is there a way to get Hibernate 5.3 to generate DDL using hbm2ddl without a database connection ?

Futhermore hibernatetools 5.3’s hbm2ddl ant task seems to leak connections when used in Gradle. We use hbm2ddl multiple times in our build and postgres reports an ever increasing number of connections until we reach our database limit and kaboom !

You need to replicate it with this test case template and open a Jira issue for this.

All right, will do that sometime tomorrow and post a link here.