Is it really `ResultSet.getObject (String, Class <T>) in JDK7?

I see quite a few changed interfaces in JDK7, for example, adding ResultSet.getObject(String, Class<T>) . I was very surprised by these incompatible changes, especially since I had never seen this discussed.

I believe that incompatibility doesn't matter when I use a JAR file instead of trying to compile the project myself, right?

What is the correct way to support JDK6 and JDK7? Is it easy to implement new methods and never use them enough?

+4
source share
3 answers

It seems

 <T> T getObject(int columnIndex, Class<T> type) throws SQLException 

and

 <T> T getObject(String columnLabel, Class<T> type) throws SQLException 

were introduced in 1.7. (At least he says β€œStarting with 1.7”) in the documentation . I agree, these are disgusting changes.

The java.sql interfaces have more changes. Connection for example, received 5 new methods in 1.7. Hopefully there will be a change.

Do you just need to execute new methods and never use them?

Yes, but do not use the @Overrides annotation for methods that are not present in an earlier version of the interface.

+2
source

Instead of Eclipse, I read ResultSet javadoc .

0
source

You can pre-implement these methods, but you cannot use the @Override annotation. It seems that Java 7 does not define any new types that would prevent you from implementing new methods in Java 6, but this is not always the case (for example, using SavePoint in Java 1.4, but there are many others).

0
source

All Articles