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: Joining by .CreateAlias over many-to-one does not work
PostPosted: Thu Nov 20, 2008 8:51 am 
Newbie

Joined: Thu Nov 20, 2008 8:41 am
Posts: 1
Hello everybody.
Hibernate version:2.0.1.4000

I am receiving some unexpected results when trying to build join criteria (via CreateCriteria or CreateAlias) over many-to-one relation:
I have Entity1. It has one-to-many relation to Entity2. Entity2 has many-to-one relation to Entity3.

So I'm trying to do something like this:

ICriteria crit = uow.CreateCriteria(typeof(Entity1));
crit.CreateAlias("Entity2Collection", "en2Alias").CreateAlias("en2Alias.en3Property", "en3Alias").Add(Restrictions.Eq("en3Alias.name", "deafsheep")).List();

What I receive is that in WHERE of query there is en3Alias.name = ?, but the actual JOIN of en3Alias does not happen. But JOIN of en2Alias happens.

Using CreateCriteria produces same results.

Any suggestions?

Thanks in advance


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.