Closed GoogleCodeExporter closed 8 years ago
This is not a bug but an enhancement.
How would you do it for hibernate?
Original comment by evernat@free.fr
on 23 Jun 2013 at 2:17
Sorry for listing it as a bug, you are right it is an enhancement. Currently,
I'm using openjpa 2.0 and I write named queries above the entities or within
DAO operation methods and I want to get the real JPA query in addition to its
translated SQL statement.
Original comment by Eng.Usam...@gmail.com
on 24 Jun 2013 at 2:54
Your comment doesn't say how to be notified about it for hibernate or for
openjpa, as you wish.
Can you complete this issue?
Thanks.
Original comment by evernat@free.fr
on 13 Aug 2013 at 9:46
I'll assume an example. Imagine we have a method that executes a JPQL named
query using OpenJPA to retrieve data from the DB "retrieveManagerEmployees".
Currently, the report generated by Melody can list this method and when
clicked, it lists the SQL statement executed through it. This SQL statement
actually is the JPQL after being translated to SQL to be executed over DB. I
wonder if java melody can capture the original JPQL query before being
translated to SQL. because sometimes it is very hard to guess the original JPA
query from the generated SQL captured by java melody
Original comment by Eng.Usam...@gmail.com
on 14 Aug 2013 at 8:35
I understand. But what java code can be written to be notified just before a
JPQL query is executed?
Original comment by evernat@free.fr
on 14 Aug 2013 at 9:51
I think you may try intercept the JPA's entity manager methods.
Original comment by Eng.Usam...@gmail.com
on 14 Aug 2013 at 2:29
how?
Original comment by evernat@free.fr
on 14 Aug 2013 at 2:44
Spring, for example, can intercept these calls.
Original comment by Eng.Usam...@gmail.com
on 14 Aug 2013 at 2:48
Do you speak of AOP or something else?
If either case, do you have some documentation or some java class for this?
Original comment by evernat@free.fr
on 14 Aug 2013 at 3:03
I'm talking about a suggested enhancement to java melody to capture the
original jpa query not only the final sql executed through monitored
methods.Yes, I suggest using AOP to intercept the entity manager of the JPA
tool to get the JPA queries if any.
Original comment by Eng.Usam...@gmail.com
on 14 Aug 2013 at 5:33
I don't have a documentation files but I suggest using Spring AOP.
Original comment by Eng.Usam...@gmail.com
on 14 Aug 2013 at 5:38
This is done, JPA queries are monitored when using a persistence.xml file.
See https://code.google.com/p/javamelody/wiki/ReleaseNotes
Original comment by evernat@free.fr
on 14 Feb 2014 at 8:46
Original issue reported on code.google.com by
Eng.Usam...@gmail.com
on 23 Jun 2013 at 11:51