You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a database administrator observes a performance problem (e.g. a slow query) it is often difficult
to determine which part of an application (e.g. in the context of an java application with spring-data-jpa which repository/method)
is the cause of the issue.
This feature proposes an extension to the sql statement generation mechanism:
Support for textual annotation of originating repository method in a generated sql statement
e.g. in the form of a comment (similar to regular query hints) that states the (simple) class Name of
the originating spring data repository as well the method which resulted in the statement.
This gives the database administrator as well as the application developer a more detailed hint where
to look for the performance problems in the application code.
Things to consider:
The comment mechanisms can be quite database dependent.
This feature is very generic and should actually be implemented at a lower (e.g. within the jpa itself).
May be one could use the jpa query hint facilities.
Here is a short example:
Without "originating repository method":
FooRepository.findBarWhereAttr1AndAttr2(..,..)
->
select*from foo where attr1, attr2
With "originating repository method":
FooRepository.findBarWhereAttr1AndAttr2(..,..)
->
select/* FooRepository.findBarWhereAttr1AndAttr2 */*from foo where attr1, attr2
we could generalize the recently introduced @Meta annotation from Spring Data MongoDB, move it
to SD commons and then use it's "comment" attribute to generate approprirate query hints to inject
the comment into the generated query.
Hibernate:
@QueryHints({ @QueryHint(name = "org.hibernate.comment", value = "test") })
EclipseLink:
@QueryHints({ @QueryHint(name = "eclipselink.sql.hint", value = "test") })
OpenJPA:
???
{code9}
Cheers,
Thomas
Thomas Darimont opened DATAJPA-365 and commented
When a database administrator observes a performance problem (e.g. a slow query) it is often difficult
to determine which part of an application (e.g. in the context of an java application with spring-data-jpa which repository/method)
is the cause of the issue.
This feature proposes an extension to the sql statement generation mechanism:
Support for textual annotation of originating repository method in a generated sql statement
e.g. in the form of a comment (similar to regular query hints) that states the (simple) class Name of
the originating spring data repository as well the method which resulted in the statement.
This gives the database administrator as well as the application developer a more detailed hint where
to look for the performance problems in the application code.
Things to consider:
The comment mechanisms can be quite database dependent.
This feature is very generic and should actually be implemented at a lower (e.g. within the jpa itself).
May be one could use the jpa query hint facilities.
Here is a short example:
Without "originating repository method":
->
With "originating repository method":
->
No further details from DATAJPA-365
The text was updated successfully, but these errors were encountered: