This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
raminaa niilian wrote:I thought there is some way to get just one value out of statement. i remember that there was such thing in .net .
but i looks like that in java land we must use a resultSet and bear its creation distruction fee :-)
The difference is in coding semantics, the same creation/destruction "fees" are incurred regardless of using Java or C#. If you find yourself using single-row result sets a lot, write your own SingleRowResultSet as a wrapper around ResultSet. Then your SingleRowResultSet wrapper can determine what to do when zero rows are returned, as Jeanne Boyarsky mentioned.
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower