How to get the JPA generated SQL query?

前端 未结 6 1191
北荒
北荒 2020-12-28 17:50

I use JPA specification and Hibernate as my vendor. I need somehow to take the generated SQL Query which is sent to the the DB (printed to the sysout) and save it as a simpl

6条回答
  •  孤城傲影
    2020-12-28 18:12

    The simple answer to your question is No. What you want to do is something that many developers would also like to do however it was not part of the JPA specification and thus the ability to get the generated SQL will depend upon what the vendor decided to do. Using Hibernate the only way to obtain the SQL is via the log.

提交回复
热议问题