DATACMNS-506 - Added section on escaping underscores in query method names.

We now explicitly discuss the case of referring to properties with underscores (e.g. first_name) in repository query methods.

Added missing language declaration for a code block.
This commit is contained in:
Oliver Gierke
2014-05-19 08:58:33 +02:00
parent 6df464b31c
commit db30597033

View File

@@ -456,6 +456,12 @@ OG Does that make sense with my comment above?-->To resolve this ambiguity you
<programlisting language="java">List&lt;Person&gt; findByAddress_ZipCode(ZipCode zipCode);
</programlisting>
<para>If your property names contain underscores (e.g.
<code>first_name</code>) you can escape the underscore in the method
name with a second underscore. For a <code>first_name</code> property
the query method would have to be named
<methodname>findByFirst__name(…)</methodname>.</para>
</section>
<section id="repositories.special-parameters">
@@ -471,7 +477,7 @@ OG Does that make sense with my comment above?-->To resolve this ambiguity you
<example>
<title>Using Pageable and Sort in query methods</title>
<programlisting>Page&lt;User&gt; findByLastname(String lastname, Pageable pageable);
<programlisting language="java">Page&lt;User&gt; findByLastname(String lastname, Pageable pageable);
List&lt;User&gt; findByLastname(String lastname, Sort sort);