[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4656) Small patch to support cross joins in Criteria queries

Chris Wilson (JIRA) noreply at atlassian.com
Wed Dec 9 09:53:10 EST 2009


Small patch to support cross joins in Criteria queries
------------------------------------------------------

                 Key: HHH-4656
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4656
             Project: Hibernate Core
          Issue Type: Patch
          Components: core
    Affects Versions: 3.5
         Environment: Recent Hibernate trunk, Ubuntu 8.04, MySQL 5.0.51a-3ubuntu5.4
            Reporter: Chris Wilson
         Attachments: hibernate-criteria-cross-join.patch

This patch allows you to do a cartesian product (cross join) in a Criteria query, deliberately
removing the supplied join conditions, and adding any that you like (prefer) via the withClause parameter of Criteria.createCriteria. For example, it enables you to do:

  Criteria c = session.createCriteria(Project.class);
  c.createCriteria("sites", JoinFragment.CROSS_JOIN);

returning a row for every Project and every Site, regardless of whether they match or not. 

I need this to implement some complex SQL queries using Criteria. I could probably use HQL or SQL but I prefer Criteria.

The patch includes some changes I made to ANSIJoinFragment's SQL formatting to make the SQL it generates easier to read, which you may prefer to leave out.

-- 
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