Permalink
Browse files

DATAJPA-227 - Improved documentation on native queries with @Query.

  • Loading branch information...
1 parent 19d2f61 commit 2d4bca7a4d4845520c2e011089aacf1e0c731c1c @olivergierke olivergierke committed Jul 23, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/docbkx/reference/jpa.xml
@@ -498,7 +498,8 @@ public class User {
in <filename>orm.xml</filename>.</para>
<example>
- <title>Declare query at the query method using @Query</title>
+ <title>Declare query at the query method using
+ <interfacename>@Query</interfacename></title>
<programlisting language="java">public interface UserRepository extends JpaRepository&lt;User, Long&gt; {
@@ -516,6 +517,17 @@ public class User {
dynamic sorting for native queries as we'd have to manipulate the
actual query declared and we cannot do this reliably for native
SQL.</para>
+
+ <example>
+ <title>Declare a native query at the query method using
+ <interfacename>@Query</interfacename></title>
+
+ <programlisting language="java">public interface UserRepository extends JpaRepository&lt;User, Long&gt; {
+
+ @Query(value = "SELECT FROM USERS WHERE EMAIL_ADDRESS = ?0", nativeQuery = true)
+ User findByEmailAddress(String emailAddress);
+}</programlisting>
+ </example>
</simplesect>
</section>

0 comments on commit 2d4bca7

Please sign in to comment.