DATAJPA-227 - Improved documentation on native queries with @Query.
This commit is contained in:
@@ -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<User, Long> {
|
||||
|
||||
@@ -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<User, Long> {
|
||||
|
||||
@Query(value = "SELECT FROM USERS WHERE EMAIL_ADDRESS = ?0", nativeQuery = true)
|
||||
User findByEmailAddress(String emailAddress);
|
||||
}</programlisting>
|
||||
</example>
|
||||
</simplesect>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user