Ok, it turns out, my problem is a little bit more complicated.
I looked into Criteria implementation, and it seems to be the solution to my problem. However, not entirely..
Using criterias, I could do the search that I wanted in the first post:
Code:
final Criteria crit = session.createCriteria(sometable.class);
final Criteria aItems = crit.createCriteria("aItems");
final Criteria bItems = aItems.createCriteria("bItems");
bItems.add(Restrictions.like("name", "somename"));
Now, each bItem has a field cItem which is an Abstract type.
I wanted to find all sometable items that have a cItem matching the search criteria, so I made this criteria:
Code:
final Criteria crit = session.createCriteria(sometable.class);
final Criteria aItems = crit.createCriteria("aItems");
final Criteria bItems = aItems.createCriteria("bItems");
final Criteria cItems = bItems.createCriteria("cItems");
cItems.add(Restrictions.like("name", "somename"));
This fails with the error message like:
Code:
WARN 08:04:59,291 JDBCExceptionReporter SQL Error: 4104, SQLState: S0001
ERROR 08:04:59,291 JDBCExceptionReporter The multi-part identifier "cItems3_1_.Name" could not be bound.
Any ideas?