my problem loooks like that. I create object survey, add to this object 2 question and for each of them i add 3 answer. I insert it to database using hibernate. Look to database, it is exactly like I said, 2 question, for each 3 answer. Then I execute getSurvey, on survey object i execute get getQuestionSet, and it return 6 question 3x first question and 3 x second queston. My code is here: https://pastebin.com/XS23YLZZ my tables are here https://pastebin.com/ZfHw3G3U, and my get method
public Survey getSurveyByName(String name)
{
Session session = null;
Survey survey = null;
try {
session = HibernateUtil.getSession();
survey = session.byNaturalId(Survey.class).using("surveyName",name ) .load ();
} catch(Exception ex) {
ex.printStackTrace();
// handle exception here
} finally {
try {if(session != null) session.close();} catch(Exception ex) {}
}
return survey;
} `
Can someone help me to fix it, that it gonna outpu only 2 question ?