hi!
I'm trying on a Criteria with FectchType.Lazy between nested objects, like that:
Code:
Criteria criteria = session.createCriteria(Department.class);
criteria.createAlias("floor", "floor");
criteria.createAlias("floor.block", "floor.block");
criteria.createAlias("floor.block.typeA", "floor.block.typeA");
//criteria.add(Restrictions.eq("floor.block.typeA.id", 110624724));
criteria.add(Restrictions.eq("floor.block.id",6650));
criteria.list();
But the commented code doesn't work! In case of the code below the comment, in restriction, works perfectly! I'm not sure, but I thing that Criteria has a limit in nested parameters, isn't it?
If you are reading the post, you can think to use an alias, like:
Code:
Criteria criteria = session.createCriteria(TmpDepartamento.class);
criteria.createAlias("floor", "x");
criteria.createAlias("floor.block", "y");
criteria.createAlias("floor.block.typeA", "z");
criteria.add(Restrictions.eq("z.id", 110624724));
criteria.list();
This works perfectly, but I need specific same name in both sides of createAlias.
Do you know how can I solve this problem?