mirror of https://github.com/apache/openjpa.git
OPENJPA-965: Open up FinderCacheImpl for jdbc and non-jdbc
like implementation git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@751148 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70cfcaaee1
commit
b612d64620
|
@ -109,6 +109,10 @@ public class FinderQueryImpl
|
|||
return _sql;
|
||||
}
|
||||
|
||||
public Column[] getPKColumns() {
|
||||
return _pkCols;
|
||||
}
|
||||
|
||||
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) {
|
||||
Object[] pks = null;
|
||||
Object oid = sm.getObjectId();
|
||||
|
@ -138,12 +142,15 @@ public class FinderQueryImpl
|
|||
PreparedStatement stmnt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
stmnt = conn.prepareStatement(_sql);
|
||||
stmnt = _select.prepareStatement(conn, _sql);
|
||||
Object[] params = getPKValues(sm, jstore);
|
||||
if (stmnt != null) {
|
||||
for (int i = 0; i <params.length; i++) {
|
||||
dict.setUnknown(stmnt, i+1, params[i], _pkCols[i]);
|
||||
}
|
||||
rs = stmnt.executeQuery();
|
||||
}
|
||||
|
||||
rs = _select.executeQuery(conn, stmnt, this, jstore, params);
|
||||
return _select.getEagerResult(conn, stmnt, rs, jstore,
|
||||
(JDBCFetchConfiguration)fetch, forUpdate, _buffer);
|
||||
} catch (SQLException se) {
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.commons.collections.iterators.EmptyIterator;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
|
||||
import org.apache.openjpa.jdbc.kernel.FinderQueryImpl;
|
||||
import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
|
||||
import org.apache.openjpa.jdbc.kernel.JDBCLockManager;
|
||||
import org.apache.openjpa.jdbc.kernel.JDBCStore;
|
||||
|
@ -439,6 +440,15 @@ public class SelectImpl
|
|||
return sql.prepareStatement(conn, fetch, rsType, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is to provide override for non-JDBC or JDBC-like
|
||||
* implementation of preparing statement.
|
||||
*/
|
||||
public PreparedStatement prepareStatement(Connection conn,
|
||||
String sql) throws SQLException {
|
||||
return conn.prepareStatement(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is to provide override for non-JDBC or JDBC-like
|
||||
* implementation of setting query timeout.
|
||||
|
@ -469,6 +479,16 @@ public class SelectImpl
|
|||
return stmnt.executeQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is to provide override for non-JDBC or JDBC-like
|
||||
* implementation of executing query.
|
||||
*/
|
||||
public ResultSet executeQuery(Connection conn, PreparedStatement stmnt,
|
||||
FinderQueryImpl finder, JDBCStore store, Object[] params)
|
||||
throws SQLException {
|
||||
return stmnt.executeQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is to provide override for non-JDBC or JDBC-like
|
||||
* implementation of getting count from the result set.
|
||||
|
|
Loading…
Reference in New Issue