- Changing this up to support the list index in general. The pull request was part of it (thanks!), but the resulting SQL currently leaves off the index condition. See https://gist.github.com/brmeyer/351b48d8d5731c1cfff5. The initial SQL is correct, but the AbstractLoadPlanBasedCollectionInitializer leaves the condition off. Taking a look. -
I take that back. The JPA spec actually disallows restricting a *fetch* with the Criteria API, but does allow restricting the *join* (as your test case was doing). To restrict the fetch, you'd have to use something Hibernate-specific and non-portable: Session#createFilter (using "index()" HQL), etc.
So, the original PR is sufficient. Thanks!
|