[hibernate-dev] Patch for HHH-2308: Adjusting the Outer Join Predicate using Criteria Query

Craig Christophel cbchrist at transgeek.com
Thu Oct 1 20:23:44 EDT 2009


Hi,
  I just wanted to check back in and see if there is anything else needed to have this considered for inclusion in trunk.   I don't exactly know the protocol required and don't mind some pointers if there is more expected.


thanks,

Craig.

----- Original Message -----
From: "Craig Christophel" <cbchrist at transgeek.com>
To: hibernate-dev at lists.jboss.org
Sent: Thursday, September 24, 2009 11:31:45 AM
Subject: [hibernate-dev] Patch for HHH-2308: Adjusting the Outer Join Predicate using Criteria Query

Hello,

  I've submitted a patch which updates Scott Van Wart's effort with unit tests and documentation changes (en-US) for HHH-2308.  This patch allows users to add Criterion to Criteria aliasing similar to the WITH clause in hql.

List result = session.createCriteria( Student.class )
  .createAlias( "preferredCourse", "pc", Criteria.LEFT_JOIN, Restrictions.eq("pc.courseCode", "HIB-A") )
  .setProjection( Property.forName("pc.courseCode") )
  .addOrder(Order.asc("pc.courseCode"))
  .list();


This is useful when sorting large and or complex data inside the database when you intend to only retrieve X number of records from the result-set.  
Without this patch we are forced to perform the same query as follows:

  1.  Query without join constraint and store results.
  2.  Query with an inner join and store results.
  3.  Manually sort in memory with java.

This effectively doubles the workload on the database as the queries are complex even without this join.  It also causes some concern as to memory constraints because the full number of allowable data elements must be loaded twice.  I'd love to be able to use HQL to solve this problem, however the search is very dynamic and the Criteria interface has helped to solve the problem much more elegantly.


The file  hibernate-outer-join-criteria-trunk.diff attached to this defect is the latest example on trunk (3.5)

Thanks,


Craig Christophel
_______________________________________________
hibernate-dev mailing list
hibernate-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list