-->
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.  [ 2 posts ] 
Author Message
 Post subject: LEFT JOIN through cross ref with additional on clause
PostPosted: Thu Dec 09, 2010 2:43 pm 
Newbie

Joined: Thu Dec 09, 2010 2:00 pm
Posts: 2
Hi,
I am trying to join two tables through a cross reference table using the Criteria API. The join is working fine until I try adding additional ON clauses.

The DB structure looks something like this:
role <==> role_permission <==>permission

When I try running the following code, I get an exception that says: No value specified for parameter 2.
Code:
Criteria criteria = session.createCriteria(Permission.class)
  .createAlias("roles", "r", Criteria.LEFT_JOIN, Restrictions.eq("r.name", "ABC"));

Looking at the generated SQL confirms that the additonal ON clause is being added to both left join criteria, i.e.
Code:
select ... from permission p
left join role_permission rp on p.permision_id = rp.permision_id AND (r.role_name=?)
left join role r on rp.role_id = r.role_id AND (r.role_name=?)

What am I missing?
Thanks


Top
 Profile  
 
 Post subject: Re: LEFT JOIN through cross ref with additional on clause
PostPosted: Thu Dec 09, 2010 6:34 pm 
Newbie

Joined: Thu Dec 09, 2010 2:00 pm
Posts: 2
Seems like question is related to a reported bug?

http://opensource.atlassian.com/projects/hibernate/si/jira.issueviews:issue-html/HHH-5264/HHH-5264.html


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

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.