Results 1 to 1 of 1
Thread: Resultset comparision method
- 07-27-2011, 11:51 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
Resultset comparision method
Hello folks,
I was wondering why when I was fetching a sql select sentence (inside RowMapper prodecude inside jdbcTemplate ), the condition I set for avoid null exception didn't work.
I mean, when having if sentence like:
why the condition worked as follows:Java Code:rs.getTimestamp("bornDate")
and notJava Code:if (rs.getTimestamp("bornDate") == null )instead.Java Code:if (rs.getTimestamp("bornDate").equals(null) )
While debugging, condition was always false with equals even if the result set got null value. Changing it by == worked like a charm.
¿Isn't supposed while comparing objects we should use equals instead of == ?.
I can understand the reference of resultset will not be null, but the value itself instead which is what I was searching for (in order to do the if sentence).
I am confused
Some advice will be helpful , thanks.
Similar Threads
-
String Comparision
By vimalaranjan in forum New To JavaReplies: 6Last Post: 05-19-2011, 02:27 PM -
Secret of String references comparision.
By Anjaneyulu in forum Advanced JavaReplies: 15Last Post: 02-24-2010, 02:32 PM -
String comparision method problem
By rons_sacramental in forum New To JavaReplies: 7Last Post: 10-15-2009, 05:15 AM -
comparision between two lists
By suprabha in forum Advanced JavaReplies: 14Last Post: 08-01-2008, 02:49 PM -
ResultSet to XML
By Java Tip in forum Java TipReplies: 0Last Post: 02-14-2008, 09:50 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks