I have a domain object annotated like this for hibernate support.
@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
}
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
private User userDetails;
How do i annotate this so that, whenever i fetch AppInput from db, the corresponding user details also get populated?