Hibernate version:
3.1
Full stack trace of any exception that occurs:
ClassCastException
Name and version of the database you are using:
Oracle 10g
Hi there, I am having a hard time with the following problem, if anyone could help me, I'd be quite happy.
I have the following relations:
A Matter has o..n roles, a role has 0...n parties.
So in code it is something like Matter.getRoles(), Party.getRoles().
What I was trying to achieve is that I use an example query for Party or Matter - the user sets the name of the party or the subject of the matter and both objects are used for an example query.
Pseudo Code:
Create a criteria on parties, use the example party object to select the right parties, from each party get the roles, from the roles select each role that has a matter that satisfies the matter example query object.
This is what I got (one of the many tries), this will give me a class cast exception for matter :(
Code:
public List lookupCandidates(Matter matter, Party party) throws PersistencyException {
/**/
Example example = Example.create(party);
Criteria criterias = getCurrentSession().createCriteria(Party.class);
criterias.add(example);
Criteria roleCriteria = criterias.createCriteria("roles");
roleCriteria.setFetchMode("roles", FetchMode.JOIN);
roleCriteria.add(Example.create(matter));
List list = criterias.list();
return list;
Any input greatly appreciated.[/code]