It's easy to get hibernate to print the sql, but I really need hibernate to print the parameters in the sql.
The only sql I can get printed is something like this:
Code:
insert into test_results (dateCompleted, student_id, test_id) values (?, ?, ?)
Where rather than showing the parameter values, there's just a bunch of "?" symbols. I'm using the latest version of hibernate 3.2.1.
I've tried adding these to my hibernate.cfg file, but they only make the sql prettier -
Code:
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.generate_statistics">true</property>
I've turned on the highest level of logging at startup, but that doesn't print the params either:
Code:
Logger logger = Logger.getLogger("org.hibernate.SQL");
logger.setLevel(Level.FINEST);
The only thing I've been able to find in the hibernate docs is this section on logging:
http://www.hibernate.org/hib_docs/v3/re ... on-loggingI've tried:
Code:
Logger logger2 = Logger.getLogger("org.hibernate");
logger2.setLevel(Level.FINEST);
and
Code:
Logger logger2 = Logger.getLogger("org.hibernate.type");
logger2.setLevel(Level.FINEST);
But those don't do it either.
I've even tried setting my MySQL database to log sql statements, but unfortunately the log file doesn't contain statements that weren't successful. (Bizarrely.)
If anyone knows how to get those sql parameters to print, could you please let me know how? I've put in a lot of work trying to track it down, but sadly, I just can't figure it out...