# Hibernate listener for create table DDL events

**URL:** <https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82>\
**Category:** Hibernate ORM\
**Created:** [January 17, 2018, 2:06pm UTC](https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82 "2018-01-17T14:06:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajithpmenon3](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@ajithpmenon3](https://discourse.hibernate.org/u/ajithpmenon3)\
**Post date:** [January 17, 2018, 2:06pm UTC](https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82/1 "2018-01-17T14:06:45Z")

</div>

I need to to capture events like create table using entity in hibernate. My application dynamically creates tables and need to audit these [events.Is](http://events.Is) there any listener available for capturing the DDL statements?

---

<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:** [January 17, 2018, 4:23pm UTC](https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82/2 "2018-01-17T16:23:05Z")

</div>

Hibernate has Event listeners for [entity state transitions](https://vladmihalcea.com/a-beginners-guide-to-jpa-hibernate-entity-state-transitions/), not DDL structure.

It’s not even possible to change the DB schema dynamically without rebuilding the `EntityManagerFactory`.

For your use case, [you are better off using Debezium.](https://vladmihalcea.com/how-to-extract-change-data-events-from-mysql-to-kafka-using-debezium/)

---

<div class="post-metadata">

**Author:** ![ajithpmenon3](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@ajithpmenon3](https://discourse.hibernate.org/u/ajithpmenon3)\
**Post date:** [January 19, 2018, 2:37pm UTC](https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82/3 "2018-01-19T14:37:07Z")

</div>

I need to do some operation after creating tables dynamically through SQLQuerry. Is there a way to add any listener or interceptor for the same

---

<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:** [January 19, 2018, 4:10pm UTC](https://discourse.hibernate.org/t/hibernate-listener-for-create-table-ddl-events/82/4 "2018-01-19T16:10:18Z")

</div>

Hibernate does not have anything for that. You will have to use something else.
