title: JPA/Hibernate Join and Fetch single column
body: <p>I'm new to JPA/Hibernate. Suppose I have these two tables:</p>
  
  <ul>
  <li>Employee (Id, Name, DeptId, ..) // DeptId is foreign key.</li>
  <li>Department (Id, DeptName, ..) // Department persisted separately</li>
  </ul>
  
  <p>and Entities like below:</p>
  
  <pre><code>@Entity
  public class Employee {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int id;
      private String name;
      private long salary;
  
      @OneToOne(cascade = {CascadeType.PERSIST})
      @JoinColumn(name="DEPT_ID") 
      private Dept dept;
      ...
      }
  
  @Entity
  public class Dept {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int id;
      private String name;
      ...
      **other huge collections with eager fetch ***
      }
  </code></pre>
  
  <p>In my application DAO, whenever I access the Employee entity, I just need the department name as part of the employee entity and nothing else from the department table.</p>
  
  <ol>
  <li>How to fetch the dept. name column ONLY and not the entire Department row in the employee entity (need to avoid eager fetches for huge collections made by department)? if so, what annotations should I use?</li>
  <li>How to handle cascade in this scenario?</li>
  </ol>