-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Criteria with strong depth
PostPosted: Wed Jun 22, 2011 7:08 am 
Newbie

Joined: Wed Jun 22, 2011 6:45 am
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.