According to the hibernate-dev mailing discussion, we need to add a new hibernate.jdbc.log.warnings configuration property that controls whether we try to fetch JDBC statement warning.
By default, this property will be false, and this way we can overcome the MySQL JDBC driver performance issue associated to getting database-generated wanings.
That's a good point. We could move this flag into Dialect and, by default, it could be set to true. Then we set it to false in MySQLDialect, and other databases whose JDBC drivers behave like MySQL (if any). What do you think? Is this a better approach?
Do you mean add to the Dialect a property for the default value of hibernate.jdbc.log.warnings property or to remove this setting an use just the property of the Dialect to control the logging?
I wasn't aware that Oracle might handle error messages via warnings, in which case the global property becomes too restrictive.
I was thinking of handling this in the Dialect and removing the property so that most drivers can benefit from logging warn messages except for MySQL.
I think the property gives more options, the user can decide to disable the warnings logs if not usefull for him while the Dialect default value gives us the ability to disable it for MySQL while keeping the logging the default behaviour for the other drivers.