[hibernate-dev] [HSEARCH] Faster way to get a query builder

Sanne Grinovero sanne at hibernate.org
Thu Jan 29 10:05:06 EST 2015

On 29 January 2015 at 15:00, Gunnar Morling <gunnar at hibernate.org> wrote:
> How would the last one be done? You would define overridesForField on
> QueryBuilder and prohibit its usage after anything else on the builder has
> been invoked?
> Or, you could have two different methods:
>     QueryBuilder getQueryBuilder(Class<?> entityType);
>     QueryBuilderContext buildQueryBuilder(Class<?> entityType);
> And then
>     QueryBuilder qb = ftem. getQueryBuilder( Hike.class );
>     QueryBuilder qb = ftem. buildQueryBuilder( Hike.class
> ).overridesForField( "organizer", "custom_analzer1" ).get();
> Naming-wise, I find buildQueryForEntity() not totally right, as the method
> doesn't build a query but a query builder. So I'd name it
> getQueryBuilder(). Or getDefaultQueryBuilder() + getQueryBuilder().

I was puzzled by the name as well. As I've written in the
same-timestamp reply of mine, I'm assuming Emmanuel is thinking of a
full method chaining.


More information about the hibernate-dev mailing list