title: JPA or Query Interception
body: <p>How do I intercept query being executed ? Basically, I have to intercept each and every query executed via EntityManger and log "NATIVE" sql to application server log file for analysis? can you please let me know is there any way to intro-spect before and after so I can log query and time it took to execute ?  </p>
  
  <p>Keep in mind that JPA engine could be hibernate or Open JPA so regardless of JPA implementation what is generic way to introspect query on serverside ?</p>
  
  <p>Any help is greatly appreciated..</p>
  
  <p>Thanks in Advance,</p>
  
  <p>Bhavesh</p>