I have a sample query like the following
String hql = "from Stock s where s.stockCode = :stockCode";
List result = session.createQuery(hql)
.setParameter("stockCode", "7277")
.list();
the result is a list like I expect it to be but I want to know how I can sysout the sql query in my Tomcat logs before the query is executed. Can I do it at the code level as opposed to setting a property in log4j or hibernate config?
In this case, I am looking for an output like
select * from Stock s where s.code = 123;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…