I'm having trouble with an ObjectNotFoundException
where Hibernate appears to be performing a select
statement where I didn't expect it too, due to lazy loading being true. I suspect something to do with AOP, but I can't change anything since I'm using someone else's framework.
I was thinking of putting a breakpoint in the place where the select statement gets generated into my log, that way I can see who's tri开发者_如何学Pythonggering it. What's the Hibernate class I should be setting breakpoints on?
I believe that the log entry is generated within org.hibernate.jdbc.util.SQLStatementLogger
Up until Hibernate line 3.6.x
, the class FQN was: org.hibernate.jdbc.util.SqlStatementLogger.
Starting with line 4.x
, at least till 5.2
the class is: org.hibernate.engine.jdbc.spi.SqlStatementLogger
Hell is other people's frameworks. You can see Hibernate logging its SQL if you configure log4j to get debug-level logging for org.hibernate.SQL and trace-level logging for org.hibernate.type. But Hibernate's SQL generation happens a long way from where it decides what it needs to do, so I doubt that will help. The SessionImpl has an ActionQueue that lists the actions Hibernate will take, you may want to watch what gets shown there.
精彩评论