I have a problem with a deadlock. The code is well complex and I cannot find which line the query is being generated from. How can I find the method that's calling hibernate. Can I log it or see it or change the log4j ? I can already see the hibernate sql that generates the deadlock but short of debugging thousands lines of code, is there an easy way to figure out which method has issued the hibernate call that generated the deadlock ?
No you cannot. You can try looking at the server logs to see if a task got killed but it will not tell you which other task was causing the issue.