so when i m firing select sysdate from dual on database
and try to retrieve result with resultset.getObject(1);
i get different results for jdk1.5 and 1.6
for jdk1.5 i got only Date
and for jdk 1.6 i got date and time both
this is because while retrieving result in jdk 1.5 sysdate is object of Date at runtime
in jdk1.6 it is an object of timestamp
so is there any solution to change it in jdk1.5 as an object of timestamp because because want to use jdk 1.5 and also need result date with time both
Using resultset.getTimeStamp() should work in both versions of Java. I'd suggest not to use the resultset.getObject() at all, always use getter for the concrete type instead. It will prevent this kind of surprises from happening.
It seems to me that you've generalized your code so much it's hurting you. I've done that in the past too, the best way out is to "ungeneralize" it a bit, in my opinion.
You could at least try to pass additional information about column types to your generalized method, and this method could use this information to call getTimestamp() instead of getObject(), if the column was DATE.