# Offline DDL generation with Hibernate 5.3

**URL:** <https://discourse.hibernate.org/t/offline-ddl-generation-with-hibernate-5-3/1764>\
**Category:** Hibernate ORM\
**Created:** [November 21, 2018, 7:27pm UTC](https://discourse.hibernate.org/t/offline-ddl-generation-with-hibernate-5-3/1764 "2018-11-21T19:27:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qkjerome](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/qkjerome/32/379_2.png) [@qkjerome](https://discourse.hibernate.org/u/qkjerome)\
**Post date:** [November 21, 2018, 7:27pm UTC](https://discourse.hibernate.org/t/offline-ddl-generation-with-hibernate-5-3/1764/1 "2018-11-21T19:27:04Z")

</div>

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:

```auto
<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 !

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [November 21, 2018, 10:16pm UTC](https://discourse.hibernate.org/t/offline-ddl-generation-with-hibernate-5-3/1764/2 "2018-11-21T22:16:58Z")

</div>

You need to replicate it with this [test case template](http://in.relation.to/2016/01/14/hibernate-jpa-test-case-template/) and open a Jira issue for this.

---

<div class="post-metadata">

**Author:** ![qkjerome](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/qkjerome/32/379_2.png) [@qkjerome](https://discourse.hibernate.org/u/qkjerome)\
**Post date:** [November 21, 2018, 10:21pm UTC](https://discourse.hibernate.org/t/offline-ddl-generation-with-hibernate-5-3/1764/3 "2018-11-21T22:21:41Z")

</div>

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