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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev