mm-mysql wrote:
abredon wrote:
Hi All,
We have a mysql instance running with query caching turned on. When we run for example a select statement from the mysql console the query gets cached, however none of our hibernate queries get cached.
I have turned hibernate.show_sql on and taken the output from hibernate, run that from the mysql console and that get's cached. So can someone please explain why it won't cache my queries through my application? I don't want to use the hibernate query cache (ehcache etc), I want to use the native mysql query cache. Please help.
Thanks,
Andrew
Hi Andrew,
Hibernate uses prepared statements. If you're using server-side prepared statements with MySQL (the default for MySQL > 4.1), these don't use the query cache. You can disable server-side prepared statements usage by the JDBC driver by including the JDBC configuration property "useServerPrepStmts=false" in your datasource declaration or URL.
-Mark
Hi... We had this problem and worked around it in exactly the same way... Unfortunately, now we are no longer using server side prepared statements we are logging lots of Data truncation errors which go away if we switch back to prepared statements.
I dug up plenty of information regarding floating point values, jdbc and data truncation errors... but we are experiencing our problems on text columns, with no apparent cause.
Im under the impression that the values would be truncated but inserted without errors..
Has anyone else experienced this...have any ideas?
thanks
gp