Inline...

On Tue, Jan 3, 2017 at 5:39 AM Gunnar Morling <gun...@hibernate.org> wrote:

> 2017-01-03 11:57 GMT+01:00 Sanne Grinovero <sa...@hibernate.org>:
>


> Btw. we'd one Tuple type per number of returns, i.e. Tuple2, Tuple3 etc.,
> each with the right number of type arguments. As said I'm not fully
> convinced myself, but some may find it nicer to use than casting the
> elements of an array.
>

That is not how Tuple works in list()/uniqueResult() even.

Look, ultimately all I am proposing here is to make Query#scroll work the
same as, e.g., Query#list in terms of its return signature.

For Query<Tuple>#list you do not get back multiple Tuple objects (per
"row").  Why would you here?

Perhaps y'all are getting hung up on the name Tuple.  Tuple represents the
entire row, each "column" in that row.  E.g.

List<Tuple> results = session.createQuery( "select e.prop1 as p1, e.prop2
as p2 from Entity e", Tuple.class ).list();

for ( Tuple tuple : results ) {
    // access "prop1":
    tuple.get(0)
    tuple.get("p1")
    ...
    // access "prop2":
    tuple.get(1)
    tuple.get("p2")
    ...
}

Tuple is really just a "nicer" (ymmv) way to deal with Object[]...
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to