OK, that will solve from 40 to 60% of my problem :-)
In fact, if I understood correctly, this need a specific constructor.
When request is static, it solve the problem.
But when the request is dynamic (the request's string provided at
runtime) I can't provide the corresponding constructor at runtime.
Any idea for that cases ?
Related question : does it save a lot of time and ressources to
restrict attribute retreived from database ?
In fact, one solution might be to always retreive all attributes ...
but I always learn from plain old SQL to use the select part of the
SQL request to restrict as much as possible the columns to retreive.
Any ideas welcome !
On Jul 28, 2009, at 20:37 , Luis Fernando Planella Gonzalez wrote:
Use select new A(a.attribute1, a.attribute2) from A a
Create a constructor to accommodate the received parameters.
Em Terça-feira 28 Julho 2009, às 15:27:31, Jean-Baptiste BRIAUD --
Novlog escreveu:
Hi,
If I use the following request SELECT a FROM A a, I got a List<A>
witch is perfectly fine.
If I use SELECT a.attribute1, a.attribute2 FROM A a, I got a
List<Object[]> where each List element is an array of 2 values for
attribute1 and attribute2.
How can I have a List<A> where only attribute1 and attribute2 are set
instead of that List<Object[]> ?
Thanks.
PS : I sent this message 3 hours ago but can't see it on the list...
so I decided to write this one.