[hibernate-dev] [HSEARCH] Full-text query returning projection of one element

Gunnar Morling gunnar at hibernate.org
Thu Jan 29 09:39:11 EST 2015


2015-01-29 13:31 GMT+01:00 Sanne Grinovero <sanne at hibernate.org>:

> I hadn't noticed that HQL projections would do that.
> It seems useful indeed, but also quite irregular.. I'm not too
> convinced, I guess I'd be happier if we could express the difference
> on the method signature's return type.
>
> I tend to agree that we should conform to the list() contract, but
> this is unlikely to be an welcome change for existing users.
> If you all agree it's an improvement, I'd schedule such an issue for 6?
>

Yes, it may come at the surprise of users relying on the current behavior.
Fixing it in HS 6 seems reasonable to me.

Sanne
>
> On 29 January 2015 at 08:49, Gunnar Morling <gunnar at hibernate.org> wrote:
> > Hi,
> >
> > When doing a full-text query which projects exactly one column, e.g. like
> > so:
> >
> >     List<?> list = fullTextSession.createFullTextQuery( query, MyEntity.
> > class )
> >         .setProjection( ProjectionConstants.ID )
> >         .list();
> >
> > Then each list element will be a single-column array, containing the
> > projection result.
> >
> > I'd rather have expected the list to contain the single column values
> > directly in this case. That's what HQL projection do and seems implied by
> > the docs of list().
> >
> > Is it done differently in HSEARCH on purpose or should it be considered a
> > bug?
> >
> > Thx,
> >
> > --Gunnar
> > _______________________________________________
> > 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