Hello... I have a collumn as unique=true.. in Exam class.... I found that because transactions are commited automaticaly so to force the commit i use em.commit()
However i would like to know how to check if it is unique.Running a query isnt a solution because it may be an instert after checking because of the concurency....
Which is the best way to check for uniqness?
List<Exam_Normal> exam_normals = exam.getExam_Normal();
exam.setExam_Normal(null);
try {
em.persist(exam);
em.flush();
Long i = 0L;
if (exam_normals != null) {
for (Exam_Normal e_n : exam_normals) {
i++;
e_n.setItem(i);
e_n.setId(exam);
em.persist(e_n);
}
}
} catch (Exception e) {
System.out.print("sfalma--");
}
}
d