title: ClassCastException on Projection for repository method
body: <p><code>java.lang.ClassCastException: au.com.parcelpoint.domain.batch.JobEntity cannot be cast to au.com.parcelpoint.domain.batch.projection.JobProjection</code></p>
  
  <p>The stack trace points to this line:</p>
  
  <pre><code>JobProjection jobProjection 
  jobRepository.findSummaryByIdAndRetailerId(jobId, retailerId);
  </code></pre>
  
  <p>I am trying to reduce the fields needed in a simple projection for an actual persistence object. My projection object is called JobProjection and my persistence object is called JobEntity.</p>
  
  <p>This is my JobProjection class:</p>
  
  <pre><code>@Projection(
          name = "jobProjection",
          types = { JobEntity.class })
  public interface JobProjection {
      @Value("#{target.id}")
      Long getId();
  
      @Value("#{target.status}")
      JobEntity.Status getStatus();
  
      @Value("#{target.batches}")
      List&lt;BatchEntity&gt; getBatches();
  
      @Value("#{target.createdOn}")
      Date getCreatedOn();
  
      @Value("#{target.retailerId}")
      Long getRetailerId();
  }
  </code></pre>
  
  <p>This is my JobRepository class (condensed):</p>
  
  <pre><code>@RepositoryRestResource(excerptProjection = JobProjection.class)
  public interface JobRepository extends CrudRepository&lt;JobEntity, Long&gt;, JobCustom {
          JobProjection findSummaryByIdAndRetailerId(Long jobId, Long retailerId);
  }
  </code></pre>