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: Detached Criteria and join
PostPosted: Tue Jul 21, 2009 3:37 am 
Newbie

Joined: Mon Jul 20, 2009 11:14 am
Posts: 2
Is it possilble in Hibernate Criteria API add a condition after "on" clause in join? I wolud like to get a query like this:

Code:
Select * from Task t
left join Attribute a
on t.task_id = a.att_task_id
and a.att_name = 'something'
where ...


So I wrote criteria:
Code:
DetachedCriteria dc = DetachedCriteria.forClass(Task,"t");
dc.createAlias("Attribute", "a");
dc.setFetchMode("Attribute", FetchMode.JOIN);
dc.add(Restrictions.eq("a.att_name", "something"));


But query which I get is:
Code:
Select * from Task t
join Attribute a
on t.task_id = a.att_task_id
where
a.att_name = 'something'


Colud somebody help me whit 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.