title: Hibernate annotations and foreign key relationship
body: <p>I have a domain object annotated like this for hibernate support.</p>
  
  <pre><code>@Entity
  @Table(name = "INPUT")
  public class AppInput {
  
    /**
     * Unique id for this request
     */
    @Id
    @GeneratedValue
    @Column(name = "INPUT_ID")
    private long requestId;
    /**
     * 
     */
    @Column(name = "EMAIL_ID")
    private String emailId;
    /**
     * 
     */
    @Column(name = "REQUEST_DATE")
        private Date requestDate;
    /**
      * 
     */
    @Column(name = "INPUT_STATUS")
     private char status;
    /**
     * 
     */
     @Column(name = "EXPECTED_ORDER_DATE")
    private Date expectedOrdDt;
  
  //Getter and setters
     }
  </code></pre>
  
  <p>The property emailId is a foreign key referring to say emailId column in User table. Lets say i add a property like this to AppInput.java<code>
  private User userDetails;</code>
  How do i annotate this so that, whenever i fetch AppInput from db, the corresponding user details also get populated?</p>