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

This commit is contained in:
Oliver Gierke
2012-07-23 19:32:52 +02:00
parent 19d2f6166f
commit 2d4bca7a4d

View File

@@ -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>