• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate sql logging with param value

 
Krishnaa Kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.,

Its known that setting show_sql=true logs all the sql queries.
Is it possible to LOG THE VALUES passed to the sql query?

With Thanks,
Krishna.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...Is it possible to LOG THE VALUES passed to the sql query?

Of course you can log the variables being passed to the query just before you call any method which would generate the SQL.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate uses prepared statements so what you probably expect, a complete string of SQL with the parameters filled in, is not possible because it does not exist at any time. But if you set the log level for org.hibernate.type to TRACE you will get the binding of parameters in the log.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic