title: Fetch selected columns from two or more table using Spring Jpa
body: <pre><code>@Entity
  public class A{
   //some properties
  }
  
  
   @Entity
   public class B{
    //Some properties
   }
  </code></pre>
  
  <p>I want to fetch selected columns from two tables using JPA, I know how to fetch single Entity table data through Repository and Controllers. </p>
  
  <p>Repository:</p>
  
  <pre><code>public interface extends JPARepository&lt;A, Long&gt;{
      List&lt;A&gt; findAll();}
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class class_name{
  @AutoWired
  private JPARepository repo;
   @RequestMapping("/data")
  public List&lt;A&gt; getData(){
  return repo.findAll();
  }
  }
  </code></pre>
  
  <p>Above code is to fetch single table data. Now, I want to fetch selected columns from both the tables.</p>
  
  <pre><code>Note: A, B Entities have mappings
  </code></pre>