[hibernate-dev] resend: RFC: implement criteria API query of collection-of-component and collection-of-value

Steve Ebersole steve at hibernate.org
Mon Dec 29 10:44:49 EST 2008


I am in the midst of significant changes which will affect the way
criteria queries are interpreted/translated.  This is all happening on a
branch named SQL_GEN_REDESIGN.  If you are interested in helping that
effort along or making sure this particular issue is addressed by those
changes then we can chat about that.  For the former, perhaps we could
chat on IRC (#hibernate-dev on freenode), though email is ok too.  For
that latter, though, we'd have to wait for this work to be done; you can
track it from JIRA :
http://opensource.atlassian.com/projects/hibernate/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10031&fixfor=10690&status=1&status=3&status=4&sorter/field=issuekey&sorter/order=DESC

and:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2407



-  

Steve Ebersole
Project Lead
http://hibernate.org
steve at hibernate.org

Principal Software Engineer
JBoss, a division of Red Hat
http://jboss.com
http://redhat.com
steve.ebersole at jboss.com
steve.ebersole at redhat.com


On Mon, 2008-12-22 at 15:49 -0500, David Mansfield wrote:
> [ I sent this about a week ago and haven't heard anything from anyone.
> Can someone let me know if I'm barking up the right tree? ]
> 
> Hi All,
> 
> The attached patch, which is not quite ready for inclusion, but works
> completely under light testing, implements the functionality
> missing from the criteria API for querying collections that are not
> collection-of-entity.  (ie. fix the causes of 'collection is not an
> association', (i.e first issue on 'Advanced Problems' faq)).
> 
> This needs some feedback and review.  I have created issue
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-3646 to
> track the issue, but I've not yet received any feedback.
> 
> Implementation notes:
> 
> The main area of change is to the CriteriaQueryTranslator class.  In
> this class, we replace the 'criteriaEntityNames' map of Criteria =>
> String with two maps, one mapping Criteria => CriteriaInfoProvider and
> one mapping String (name) => CriteriaInfoProvider.
> 
> The new class, CriteriaInfoProvider is an interface/abstraction to the
> functionality needed by the various entry points into the translator,
> such as to retrieve the 'spaces', get the PropertyMapping etc.
> 
> There are 3 concrete implementations of CriteriaInfoProvider:
> 
> * EntityCriteriaInfoProvider: this is the functionality that was always
> present in the translator, ie. use getEntityPersister() etc.
> 
> * ComponentCollectionInfoProvider: this is the functionality that
> extends the api for collection-of-component.  In this class, we have to
> provide the collection 'spaces' and the 'collection persister', but we
> also have to look in detail at the ComponentType to be able to resolve
> property references off of the component.
> 
> * ScalarCollectionInfoProvider: this is the functionality the provides
> the api for collection-of-value.  The main thing here is we use the
> SessionFactoryHelper (part of the HQL tree) to get the
> CollectionPropertyMapping object for mapping the 'elements','indices'
> etc. properties.  There's at least one 'I have no idea what to put here'
> method in this class.
> 
> There is substantial cruft in the patch for debugging, which will not be
> part of the final implementation.
> 
> There is a crude hack in CriteriaJoinWalker which needs some expert
> advice:  the existing implementation was looking at some mysterious
> 'consumesEntityAlias' boolean, but I need to force the code to lookup
> the alias from the translator every time, or else it bypasses the alias
> for the collection itself, and the SQL aliases are wrong.
> 
> There is also a completely separate bugfix wedged in here, which needs
> to be extracted to its own issue/patch.  The changes to JoinWalker are
> necessary and correct: if the last association will not generate any
> selectFragment, then the implementation adds an extraneous ", " to the
> generated string.
> 
> Looking forward to your feedback and working together to get this into
> the tree.  Need info about test cases to create, documentation etc.
> 
> Thanks,
> David Mansfield
> Cobite, INC.
> 
> 
> 
> 
> _______________________________________________
> 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