I am looking for a hibernate criteria to get following:
Dokument.class
is mapped to Role
roleId
Role.class
has a ContactPerson
contactId
Contact.class
FirstName
LastName
I want to search for First or LastName on the Contact class and retrieve a list of Dokuments connected.
I have tried something like this:
session.createCriteria(Dokument.class)
.setFetchMode("role",FetchMode.JOIN)
.setFetchMode("contact",FetchMode.JOIN)
.add(Restrictions.eq("LastName","Test")).list();
I get an error could not resolve property "LastName" for class "Dokument"
Can someone explain why the join searches on Dokument and not on all joined tables? Thanks in advance for all the help!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…