J. Kevin Robbins wrote:
First option, instead of using "while (rset.next())" I could use a "for" statement to just get the number of records required.
What do you mean? How would for() be any different than while()?
Second option, I could go ahead and get all the records and then after the beans are loaded in the Collection, I can work my way through the collection removing the records I don't want.
I'm leaning toward the second option just because I think the code will be easier to read and follow.
Since I don't really understand what you mean by the first option, I can't compare them, but thinking in terms of ease of readability is definitely the way to go.
However, the first option is almost certainly more efficient.
For 11 or even 111 or probably 1,111 records, you won't notice the difference.
Maybe there is another option that I'm not seeing?
You could try something like this:
But not all
JDBC drivers support this"
javadocs wrote:throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method or this method is not supported for the specified result set type and result set concurrency.