Hello,
I was faced with a problem for some time to display the value of the parameters passed in queries hibernate. In the logs, I saw only question marks that have frankly no added value.
I stumbled today on this Jira Hibernate: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2835 . With it, I just solved my problem and this solution may be able to help some people.
To summarize, there is conflict between some versions of log4j and some versions of Hibernate and in this case the parameter org.hibernate.type no longer relevant. To solve the problem, just follow these four steps:
- Replace the file log4j category org.hibernate.type by org.hibernate.type.workaround
- HibernateContext.xml file, add to the description of the sessionFactory bean dependency on bean hibernate-type-logging-workaround:
<bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" singleton="true" depends-on="hibernate-type-logging-workaround"> - Add the bean hibernate-type-logging-file workaround HibernateContext.xml
<bean id="hibernate-type-logging-workaround" class="com.test.logger.LogHibernateHelper" singleton="true" /> - Write LogHibernateHelper class as follows:
com.test.logger package;
org.apache.commons.logging.Log import;
org.apache.commons.logging.LogFactory import;
public class {LogHibernateHelper
public LogHibernateHelper () {
Log workaroundLog LogFactory.getLog = ("org.hibernate.type.workaround");
Log typeLog LogFactory.getLog = ("org.hibernate.type");
if (instanceof workaroundLog org.apache.commons.logging.impl.Log4JLogger
& & Instanceof typeLog org.apache.commons.logging.impl.Log4JLogger) {
org.apache.log4j.Logger log4jWorkaroundLogger = (org.apache.log4j.Logger)
((Org.apache.commons.logging.impl.Log4JLogger) workaroundLog). GetLogger ();
org.apache.log4j.Logger log4jTypeLogger = (org.apache.log4j.Logger)
((Org.apache.commons.logging.impl.Log4JLogger) typeLog). GetLogger ();
log4jTypeLogger.setLevel (log4jWorkaroundLogger.getLevel ());
}
}
} In this way we obtain log much more useful because not only parameter values but the values returned.


