title: Switching @Query to nativeQuery causes PropertyReferenceException
body: <p>I'm using Spring JPA with Hibernate &amp; PostgreSQL.</p>
  
  <p>I have the following JPA repository:</p>
  
  <pre><code>import org.springframework.data.domain.Page;
  import org.springframework.data.domain.Pageable;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.query.Param;
  
  import java.util.UUID;
  
  public interface EventRepository extends JpaRepository&lt;Event, UUID&gt; {
      @Query(value = "Select * From event Where ST_Intersects(ST_SetSRID(ST_MakeBox2D(ST_MakePoint(:swLongitude, :swLatitude), ST_MakePoint(:neLongitude, :neLatitude)), 4326), location)", nativeQuery = true)
      Page&lt;Event&gt; qwerty(@Param("swLatitude") double swLatitude, @Param("swLongitude") double swLongitude, @Param("neLatitude") double neLatitude, @Param("neLongitude") double neLongitude, Pageable pageable);
  }
  </code></pre>
  
  <p>Back when the query was HQL and didn't have <code>nativeQuery</code> set as <code>true</code> it worked fine. Now I need to move to a native SQL query, and though adding <code>nativeQuery = true</code> and rewriting the query would solve it.</p>
  
  <p>However, I now get:</p>
  
  <pre><code>Caused by: org.springframework.data.mapping.PropertyReferenceException: No property qwerty found for type Event!
  at org.springframework.data.mapping.PropertyPath.&lt;init&gt;(PropertyPath.java:75)
  at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
  at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
  at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
  at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
  at org.springframework.data.repository.query.parser.Part.&lt;init&gt;(Part.java:76)
  at org.springframework.data.repository.query.parser.PartTree$OrPart.&lt;init&gt;(PartTree.java:213)
  at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:321)
  at org.springframework.data.repository.query.parser.PartTree$Predicate.&lt;init&gt;(PartTree.java:301)
  at org.springframework.data.repository.query.parser.PartTree.&lt;init&gt;(PartTree.java:82)
  at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.&lt;init&gt;(PartTreeJpaQuery.java:60)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:91)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:168)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:69)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.&lt;init&gt;(RepositoryFactorySupport.java:320)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:169)
  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:224)
  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:210)
  at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
  ... 34 more
  </code></pre>
  
  <p>Obviously, it used to not be called <code>qwerty</code>; I just renamed it to illustrate this better.</p>
  
  <p>It seems to ignore the <code>@Query</code> annotation somehow, and that it is the annotation which should define the query to execute, and tries to interpret it based on the method name instead.</p>
  
  <p>Any ideas what I'm doing wrong?</p>