Deprecate JdkVersion (for optimistic compatibility with newer JDK generations)
Issue: SPR-13312
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import javax.sql.rowset.CachedRowSet;
|
||||
import javax.sql.rowset.RowSetFactory;
|
||||
import javax.sql.rowset.RowSetProvider;
|
||||
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet;
|
||||
import org.springframework.jdbc.support.rowset.SqlRowSet;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
@@ -34,8 +33,8 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* <p>The default implementation uses a standard JDBC CachedRowSet underneath.
|
||||
* This means that JDBC RowSet support needs to be available at runtime:
|
||||
* by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} class on Java 5 and 6,
|
||||
* or the {@code javax.sql.rowset.RowSetProvider} mechanism on Java 7 / JDBC 4.1.
|
||||
* by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} class on Java 6,
|
||||
* or the {@code javax.sql.rowset.RowSetProvider} mechanism on Java 7+ / JDBC 4.1+.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2
|
||||
@@ -49,12 +48,13 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
|
||||
private static final CachedRowSetFactory cachedRowSetFactory;
|
||||
|
||||
static {
|
||||
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_17) {
|
||||
// using JDBC 4.1 RowSetProvider
|
||||
if (ClassUtils.isPresent("javax.sql.rowset.RowSetProvider",
|
||||
SqlRowSetResultSetExtractor.class.getClassLoader())) {
|
||||
// using JDBC 4.1 RowSetProvider, available on JDK 7+
|
||||
cachedRowSetFactory = new StandardCachedRowSetFactory();
|
||||
}
|
||||
else {
|
||||
// JDBC 4.1 API not available - fall back to Sun CachedRowSetImpl
|
||||
// JDBC 4.1 API not available - fall back to Sun CachedRowSetImpl on JDK 6
|
||||
cachedRowSetFactory = new SunCachedRowSetFactory();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user