File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes hibernate sql logging with param value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate sql logging with param value" Watch "hibernate sql logging with param value" New topic
Author

hibernate sql logging with param value

Krishnaa Kumar
Greenhorn

Joined: May 05, 2011
Posts: 25
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

Joined: Mar 24, 2008
Posts: 3833

...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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
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.
 
GeeCON Prague 2014
 
subject: hibernate sql logging with param value