Java 使用RowSetProvider获取RowSetFactory的原因是什么?
我注意到如果我使用Java 使用RowSetProvider获取RowSetFactory的原因是什么?,java,jdbc,rowset,Java,Jdbc,Rowset,我注意到如果我使用 RowSetFactory rowSetFactory = RowSetProvider.newFactory(); 及 newFactory方法实现: public static RowSetFactory newFactory() throws SQLException { // Use the system property first RowSetFactory factory = null;
RowSetFactory rowSetFactory = RowSetProvider.newFactory();
及
newFactory方法实现:
public static RowSetFactory newFactory()
throws SQLException {
// Use the system property first
RowSetFactory factory = null;
String factoryClassName = null;
try {
trace("Checking for Rowset System Property...");
factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
if (factoryClassName != null) {
trace("Found system property, value=" + factoryClassName);
factory = (RowSetFactory) getFactoryClass(factoryClassName, null, true).newInstance();
}
} catch (ClassNotFoundException e) {
throw new SQLException(
"RowSetFactory: " + factoryClassName + " not found", e);
} catch (Exception e) {
throw new SQLException(
"RowSetFactory: " + factoryClassName + " could not be instantiated: " + e,
e);
}
在这里,我们看到该方法返回在system.property中设置的RowSetFactory
更改此系统属性的原因是什么
默认情况下谁设置了此属性?只有在未明确设置系统属性时,才会得到相同的结果。。。顺便说一句:你的问题在API文档中得到了回答:可以有替代的实现,我不明白你为什么需要问这个问题。好的。我想知道我应该在什么情况下使用替代实现。在替代实现中有什么不同呢?主要原因是其他实现是否提供了更好的支持或修复了bug;想一想数据库实现特有的技巧,简单地加载、刷新或存储行集中的数据。然而,我实际上不知道是否有任何替代实现可用。
public static RowSetFactory newFactory()
throws SQLException {
// Use the system property first
RowSetFactory factory = null;
String factoryClassName = null;
try {
trace("Checking for Rowset System Property...");
factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
if (factoryClassName != null) {
trace("Found system property, value=" + factoryClassName);
factory = (RowSetFactory) getFactoryClass(factoryClassName, null, true).newInstance();
}
} catch (ClassNotFoundException e) {
throw new SQLException(
"RowSetFactory: " + factoryClassName + " not found", e);
} catch (Exception e) {
throw new SQLException(
"RowSetFactory: " + factoryClassName + " could not be instantiated: " + e,
e);
}