[hibernate-dev] [HSEARCH] Faster way to get a query builder
Gunnar Morling
gunnar at hibernate.org
Thu Jan 29 10:00:00 EST 2015
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().
--Gunnar
2015-01-29 15:19 GMT+01:00 Emmanuel Bernard <emmanuel at hibernate.org>:
> https://gist.github.com/emmanuelbernard/3ca431a8fa58b69cf6c3 <
> https://gist.github.com/emmanuelbernard/3ca431a8fa58b69cf6c3>
>
> //curent
> QueryBuilder b = ftem.getSearchFactory().buildQueryBuilder().forEntity(
> Hike.class ).get();
>
> //a bit shorter
> QueryBuilder b = ftem.buildQueryForEntity( Hike.class ).get();
>
> // shortest but no field overriding
> QueryBuilder b = ftem.buildQueryForEntity( Hike.class );
>
> Thoughts?
> _______________________________________________
> 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