[hibernate-dev] implement criteria query collection-of-component and collection-of-value against latest 3.5.0-Beta-3

David Mansfield hibernate at dm.cobite.com
Fri Jan 22 10:28:58 EST 2010


Hi All

Ok.  I can't figure why the attachments were stripped by they're
attached to: 

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

Look for patches 0001 through 0005.

I hope you'll consider reviewing this patch series.  This has been
around quite a while now and I don't believe it would be that much work
to review.  I'd be happy to jump on IRC and discuss it if you have the
time.  

I've added the documentation and test cases as you requested last time
this came up, and removed my debugging logging etc, so I believe this is
a fully-cooked version.

Additionally, I think that you'd be able to validate that it doesn't
change the currently working case and only affects the cases where the
code throws the "not an association" exception.

HTH,
David


On Thu, 2010-01-21 at 12:10 -0600, Steve Ebersole wrote:
> Odd.  No clue about why they would get stripped.  Ideas about what to
> do, attach them to a Jira "patch" issue?
> 
> We are all working on JPA 2 support ATM, so I would not expect much on
> this in the short term.  
> 
> BTW, have you tried the JPA 2 criteria queries?  They do have support
> for this and our impl does already as well.  Just another option,
> especially considering I believe it very likely we will be depracting
> our current criteria API and using the JPA 2 one (with extensions built
> on top) moving forward.
> 
> On Thu, 2010-01-21 at 13:02 -0500, David Mansfield wrote:
> > Well my patches got stripped...  Any ideas?
> > 
> > On Thu, 2010-01-21 at 12:39 -0500, David Mansfield wrote:
> > > Hi All,
> > > 
> > > Attached is a series of patches which implements the missing
> > > functionality for Criteria queries, namely being able to use Criteria
> > > queries for collections of components or scalars.
> > > 
> > > The patch series includes documentation changes and test cases.
> > > 
> > > I'd love for this to get into the project, and would appreciate any
> > > feedback or questions and will work to resolve any issues.
> > > 
> > > The first two patches are necessary groundwork and bugfixes for the real
> > > code.  
> > > 
> > > This code (against 3.3.1 and previous) has been in production for a long
> > > time here and has no known issues.
> > > 
> > > Here's some info about the patches as a series:
> > > 
> > > Patch 0001: In the JoinWalker, we assemble an SQL select list fragment
> > > from a list of Joinables.  Reading the existing code, we see it's
> > > possible for the fragment generated to be empty.  However if the LAST
> > > joinable generates an empty fragment, we put a spurious comma into the
> > > fragment.  Fix this by only prepending a comma when necessary.
> > > 
> > > Patch 0002: In the CriteriaQueryTranslator, we process the path given by
> > > a SubCriteria object looking for the entity name for the property.  If
> > > the SubCriteria was mistakenly created on a component type, we will exit
> > > the loop using the owning entity, and will eventually end up failing
> > > (throwing an exception) trying to lookup up the restricted property
> > > against the entity, instead of against the component.  Fix this by
> > > throwing a more informative exception, and modify the documentation to
> > > be explicit about how to do this properly.
> > > 
> > > Patch 0003: Implement the enhancement named.  This includes the
> > > documentation changes.  The general approach is:
> > > - create an interface called the CriteriaInfoProvider which abstracts
> > > the operations that are different for the different types of Criteria
> > > targets.
> > > - change the getPathEntityName method to be a factory method for
> > > creating the proper implementation of the interface
> > > - change the rest of CriteriaQueryTranslator to use the interface
> > > instead of using the previous entity-only implementation
> > > - implementations of the interface exist for
> > >   Entity: this implements the same code as currently exists
> > >   ComponentCollection: for collection-of-component
> > >   ScalarCollection: for collection-of-value
> > >   Component: for components
> > > - update the logic in CriteriaJoinWalker which has to be very careful
> > > about how it works since the walker walks certain property paths twice.
> > > 
> > > Patch 0004: the test case for collection-of-value
> > > 
> > > Patch 0005: the test case for collection-of-component
> > > 
> > > Thanks,
> > > David Mansfield
> > > Cobite INC.
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > 
> > 
> > _______________________________________________
> > 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