title: Custom queries don't work with interface projections in Spring Data Neo4j repositories
body: <p>To exclude some of the entity's fields I created an interface projection which returns only some of the fields.</p>
  <p>I wanted to add a method in the repository interface (which extends <strong>Neo4jRepository</strong>) which uses a custom query written in Cypher (using the <strong>@Query</strong> annotation)</p>
  <p>This method works if I set the return object to Entity but it returns <code>null</code> when the return object is set to the projection. Projections work with the normal repository methods (without custom queries)</p>
  <p>Example code:
  <em>Also - I use lombok but I doubt that it makes any difference here</em></p>
  <p><em>PersonEntity.java</em></p>
  <pre><code>@NodeEntity
  @Data
  public class Person {
    @Id
    @GeneratedValue
    private Long id;
    @Property(&quot;first_name&quot;)
    private String firstName;
    @Property(&quot;last_name&quot;)
    private String lastName;
    @Property(&quot;is_man&quot;)
    private boolean isMan;
  </code></pre>
  <p><em>PersonProjection.java</em></p>
  <pre><code>public interface PersonProjection {
    Long getId();
    String getFirstName();
    boolean getIsMan();
  }
  </code></pre>
  <p><em>PersonRepository.java</em></p>
  <pre><code>public interface PersonRepository extends Neo4jRepository&lt;Person, Long&gt; {
    @Query(&quot;MATCH (n:`Person`) WHERE n.`is_man` = true WITH n RETURN n&quot;)
    List&lt;PersonProjection&gt; findMen(); // doesn't work, returns null
  
    List&lt;PersonProjection&gt; findAllByIsManTrue(); // works, returns the list of men
  }
  </code></pre>
  <p>Some things to note:</p>
  <ol>
  <li>This cypher query is 100% correct. Tested it in Neo4j Desktop and it works as expected</li>
  <li>Of course this example is trivial and I normally wouldn't need a custom query for that but the problem will get back to me when some more complex queries arise</li>
  <li>As I said, the custom query method works when I use entity instead of projection. And while using projection, the debug log says <code>looking for concrete class to resolve label: Person</code> so maybe it somehow forces the usage of entity? Just a thing I thought about</li>
  <li>I'm using the latest version of <code>spring-boot-starter-data-neo4j</code></li>
  </ol>
  <p>Is there a way to fix it? How could I do it? And if the fix is not possible, what's the other way I could approach this issue?</p>