Hi,

If what you want is the result as an A with some number of fields populated, you can use a fetch plan with a fetch group that calls for just the fields that you need.

In my experience, there is not much performance difference between fetching 1 primitive field versus 10 primitive fields from the database. If you fetch 100 or 1000, there might be a difference.

Craig

On Jul 28, 2009, at 1:08 PM, Jean-Baptiste BRIAUD -- Novlog wrote:

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.




Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:craig.russ...@sun.com
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to