我想坚持实体InterviewFeedback
。 InterviewGuide
和Application
是其他实体。我应该作为参数传递整个实体实例(例如,Application
),还是仅传递实体的id,然后通过其id进行查询以查找实例?将整个实体实例作为参数传递的问题是什么?
public void createInterview(Date interviewDate, Interviewer interviewer, InterviewGuide interviewGuide, Application application) {
InterviewFeedback interviewFeedback = new InterviewFeedback();
interviewFeedback.setInterviewer(interviewer);
interviewFeedback.setInterviewDate(interviewDate);
interviewFeedback.setInterviewGuide(interviewGuide);
if (knowIfInterviewHasPhoneInterviewGuide(InterviewType.PHONE, application)) {
interviewFeedback.setInterviewType(InterviewType.PHONE);
} else {
interviewFeedback.setInterviewType(InterviewType.PRESENCIAL);
}
interviewFeedback.setApplication(application);
em.persist(interviewFeedback);
}