title: How to write a custom @Query in Spring Data JDBC?
body: <p>In Spring Data JDBC examples, how do I write a simple query in <code>@Query</code> annotation?</p>
  
  <p>e.g. In <a href="https://github.com/spring-projects/spring-data-examples/blob/master/jdbc/basics/src/main/java/example/springdata/jdbc/basics/aggregate/LegoSetRepository.java" rel="nofollow noreferrer">LegoSet Repository</a>, how do I add a simple <code>findByName</code> query?</p>
  
  <p>When I tried </p>
  
  <p><code>@Query("select * from lego_set where name = :name")
   List&lt;LegoSet&gt; findByName(@Param("name") String name);
  </code>
  it throws following error:</p>
  
  <pre><code>org.springframework.data.mapping.MappingException: Could not read property @org.springframework.data.annotation.Id() @org.springframework.data.relational.core.mapping.Column(value=handbuch_id, keyColumn=)private java.lang.Long example.springdata.jdbc.basics.aggregate.Manual.id from result set!
  ...
  
  &gt; Caused by: org.hsqldb.HsqlException: Column not found: manual_handbuch_idat org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) `
  </code></pre>
  
  <p>Also, the reference document seems to be copied from some generic spring data document since it mentioned derived query which doesn't exist in spring data jdbc yet.</p>