[hibernate-dev] ScrollableResults and 6.0
Steve Ebersole
steve at hibernate.org
Tue Jan 3 09:37:37 EST 2017
Inline...
On Tue, Jan 3, 2017 at 4:58 AM Sanne Grinovero <sanne at hibernate.org> wrote:
> It sounds great but I'm not sure it's possible?
>
No idea what this means. Its more than possible. In fact its already
largely done. What do you mean?
For example how would this handle projections?
Exactly the same way you'd handle them for list(), uniqueResult(), etc.
E.g. using list():
List<Object[]> results = session.createQuery( "select p.name.first,
p.name.last from Person p" ).list();
vs.
ScrollableResults<Object[]> results = session.createQuery( "select
p.name.first, p.name.last from Person p" ).scroll();
or using Tuples if you prefer:
List<Tuple> results = session.createQuery( "select p.name.first,
p.name.last from Person p", Tuple.class ).list();
vs.
ScrollableResults<Tuple> results = session.createQuery( "select
p.name.first, p.name.last from Person p", Tuple.class ).scroll();
> I guess it's a similar
> doubt as the one Gunnar shared, but while he suggests a semi-typesafe
> solution, I'm not sure how cool it is to give the feeling that types
> are being checked when they might actually blow at runtime, if the
> query string doesn't match expectations.
> Could an Annotation Processor verify the declared return types really
> match the HQL select?
>
I really have no idea what this is all about...
More information about the hibernate-dev
mailing list