1

I want to save change database scripts in my version control for log and history Or maybe use Flyway in feature.

I use hibernate ddl-auto update mode in develop time to change and update database schema.

How can get queries that hibernate apply to database when run app in ddl-auto=update mode?

Does hibernate give me API or log file or alternative solution?

Any body have suggest?

Javad Kargar
  • 1,275
  • 1
  • 12
  • 27
  • 1
    check this https://geowarin.github.io/generate-ddl-with-hibernate/ – ali akbar azizkhani Jul 07 '18 at 18:35
  • https://stackoverflow.com/questions/33700123/hibernate-5-generate-sql-ddl-into-file – ali akbar azizkhani Jul 07 '18 at 18:37
  • @aliakbarazizkhani yup. That is clever method and according to 'https://stackoverflow.com/questions/32178041/where-did-configuration-generateschemacreationscript-go-in-hibernate-5' seems generateSchemaCreationScript function is deprecated and not exists in hibernate 5. I should change and test it with hibernate 5. Thanks dude. – Javad Kargar Jul 08 '18 at 06:48

1 Answers1

0

You can set below property for get queries.

<prop key="hibernate.show_sql" >true</ prop>
<prop key="hibernate.format_sql" >true</ prop>
<prop key="hibernate.use_sql_comments">true</prop>
Pramod
  • 424
  • 2
  • 7
  • 28
  • These properties just show generated SQL's in console. This is not answer. I want get generated SQL in separate file or get it through API not in console. – Javad Kargar Jul 08 '18 at 05:36