• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where to see output of hbm2ddl?

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm trying to see the SQL queries generated by Hibernate persistence provider..I have this in my persistence.xml:


But I see no output in the server logs showing any SQL...
 
ruben depuben
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The show.sql property is used for turning on and off the actual live SQL that is generated by Hibernate to store, retrieve and update objects in the underlying database. What you want is the DDL script that defines the database. I use an ANT task to run hbm2ddl that looks like this:



As you can see this exports the DDL script to a file named database-ddl.sql in the directory ${schema.dir}. But you may be able to set the DDL generation in the main hibernate configuration file too with the hibernate.hbm2ddl.auto property. Look HERE and search for hibernate.hbm2ddl.auto.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for explaining that..but what I am really looking for is a way to see the the queries that are generated when I do something like

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic