I have these two classes
@Table(name=”candidateinfo”)
Class CandidateInfo{
….
@OneToMany
CandidateResume candidate;
….
}
@Table(name=”candidateResume”)
Class CandidateResume{
….
@ManyToOne
CandidateInfo candidates;
…….
}
Now i want to add two restrictoins from 2 different classes(as above) in the below criteria
for this i have
Criteria crit = session.createCriteria(CandidateResumeInfo.class);
crit.add(Restrictions.eq(“resumeSearchable”, 1));// resumeSearchable is in CandidateResume
crit.createCriteria(“candidate”)
.add(Restrictions.eq(“userid”,1)); // userid is in CandidateInfo Class
List rsList = crit.list(); // At this line it goes to exception and not giving any error
for(Iterator it=rsList.iterator(); it.hasNext();)
Could you please explain what exactly are you trying to search but if I understand you correctly you want to search for all results where canditate id = 1 and candidateresume. searchable = 1;
Then you need to make something like the following following query: