I have a problem for Find By Example queries. I have a class A with a reference to a class B. when I set a property of the B class the Find By Example mechanism does not use the B property to generate the sql query (according to the documentation it is normal).
Code:
Session current = sessionFactory.getCurrentSession();
Criteria criteria = current.createCriteria(instance.getClass()).add(Example.create(instance));
But I my case I have only one method to search my object by example taking a java.lang.Object as argument. So I can not do the following code
Code:
List results = session.createCriteria(Cat.class)
.add( Example.create(cat) )
.createCriteria("mate")
.add( Example.create( cat.getMate() ) )
.list();
Because the class name is never the same. How can I determine when I receive a class that has associated classes?[/code]