[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-879) Enable joining the same association twice with Criteria

Silver Sepp (JIRA) noreply at atlassian.com
Thu Jun 25 06:49:38 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33470#action_33470 ] 

Silver Sepp commented on HHH-879:
---------------------------------

I was quite shocked to learn multiple association paths aren't allowed. I seem to have gotten around the problem for now by using EXISTS' and subqueries. Execution plan is not as good as it would have been with regular joins but it's OK for now.

foreach (var filter in filters)
{
	DetachedCriteria parameterRestriction = DetachedCriteria.For<ParameterValue>()
		.Add(Restrictions.Eq("Value", filter.Value))
		.Add(Restrictions.Eq("Parameter.Id", filter.ParameterId))
		.Add(Restrictions.EqProperty("Product.Id", "rootCriteria.Id"))
		.SetProjection(Projections.Property("Id"));

	rootCriteria.Add(Subqueries.Exists(parameterRestriction));
}

> Enable joining the same association twice with Criteria
> -------------------------------------------------------
>
>                 Key: HHH-879
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-879
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>            Reporter: Vladimir Bayanov
>
> Make double joining the same association with Criteria.createCriteria possible. See: http://forum.hibernate.org/viewtopic.php?t=931249

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list