Code:
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Exam> cq = cb.createQuery(Exam.class);
Root<Exam> ex = cq.from(Exam.class);
cq.select(ex).where(cb.and(cb.like(ex.<String>get("codeName"), codename + '%'),
ex.get("examType").in(Exam.ExamType.Exam_Boolean)));
ex.get("examType").in(Exam.ExamType.Exam_Boolean)));Ξ—ere is the problem...
THIS DOESNT work.
here is how it is declared in EXAM class
Code:
@Enumerated(EnumType.STRING)
@Column(updatable=false,insertable=true)
private ExamType examType;
THe problem is this doesnt work and i dont know why...
Using eclipseLink this works great but has other problems.
The only fix is to put Exam_Boolean as string
ex.get("examType").in("Exam_Boolean")));
works...
WHY?!