-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Why can't Hibernate print SQL statements with parameters?
PostPosted: Thu Oct 05, 2017 3:12 pm 
Newbie

Joined: Wed Feb 22, 2017 4:35 pm
Posts: 19
I'm aware there's a way to do this (which I am struggling to set up), but even if I get that to work, hibernate will print each parameter in its own line with bind parameter yada yada. Why can't hibernate simply print out the string that it is sending directly to the database?


Top
 Profile  
 
 Post subject: Re: Why can't hibernate print SQL statements with parameters?
PostPosted: Fri Oct 06, 2017 3:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1630
Location: Romania
As I explained in this article, Hibernate can do that just fine.

You only have to add a TRACE logger for org.hibernate.type.descriptor.sql package.

However, if you want to do it like a pro, then you should use datasource-proxy or p6spy. This way, you can even detect N+1 query issues automatically. Cool, right?


Top
 Profile  
 
 Post subject: Re: Why can't Hibernate print SQL statements with parameters?
PostPosted: Fri Oct 06, 2017 1:29 pm 
Newbie

Joined: Wed Feb 22, 2017 4:35 pm
Posts: 19
Thanks, that gives me something to chew on for sure.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.