[hibernate-dev] [Search] The case against searching with Criteria + restrictions

Sanne Grinovero sanne at hibernate.org
Fri Mar 21 08:41:29 EDT 2014

The question of being able to filter via Criteria or Hibernate Session
Filters is a recurring feature request so we need to be cautious here.

You make good points, and if it comes to a choice of support either/or
we'll certainly drop the Criteria filtering as obviously we won't make
concessions on correctness.

I'm sure that Criteria filtering is actually being used by several
other teams, and while they are aware of it being "borderline", it's
good enough for them; so rather than drop it I want to have a better
look at alternatives; worst case I'll end up with a refreshed
understanding of this code area.

Ultimately if we decide to drop it altogether, we might want to remove
the option of specifying the Criteria altogether in favor or a "fetch
graph" hint from JPA 2.1: probably more suited for the purpose and
gives no room for unpredictable behaviour.

-- Sanne

On 21 March 2014 11:50, Guillaume Smet <guillaume.smet at gmail.com> wrote:
> Hi Hardy,
> On Fri, Mar 21, 2014 at 12:14 PM, Hardy Ferentschik <hardy at hibernate.org> wrote:
>> I am even wondering whether we should not go a step further and disallow
>> the use of Criterias altogether in FullTextSessionImpl by throwing an exception
>> in case of its use. We then can add an explicit method to FullTextSession which
>> allows just the setting of the fetch type for a given association of an entity.
>> Under the hood it can still use the Criteria, but it will prevent the unsupported use
>> of Criteria queries.
> Thanks for your feedback.
> As for me, I think generalizing what is done in
> FullTextQueryImpl.getResultSize() when isSizeSafe() is false might be
> sufficient for the moment.
> I don't use this option though so I don't know exactly why it's used
> and if being able to set a Criteria query might be useful.
> --
> Guillaume
> _______________________________________________
> 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