List of usage examples for java.sql CallableStatement setFetchDirection
void setFetchDirection(int direction) throws SQLException;
ResultSet
objects created using this Statement
object. From source file:org.apache.openjpa.jdbc.sql.SQLBuffer.java
/** * Create and populate the parameters of a prepred statement using the * SQL in this buffer and the given fetch configuration. *///from w w w . j av a2 s. co m public CallableStatement prepareCall(Connection conn, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws SQLException { if (rsType == -1 && fetch == null) rsType = ResultSet.TYPE_FORWARD_ONLY; else if (rsType == -1) rsType = fetch.getResultSetType(); if (rsConcur == -1) rsConcur = ResultSet.CONCUR_READ_ONLY; CallableStatement stmnt; if (rsType == ResultSet.TYPE_FORWARD_ONLY && rsConcur == ResultSet.CONCUR_READ_ONLY) stmnt = conn.prepareCall(getSQL()); else stmnt = conn.prepareCall(getSQL(), rsType, rsConcur); try { setParameters(stmnt); if (fetch != null) { if (fetch.getFetchBatchSize() > 0) stmnt.setFetchSize(_dict.getBatchFetchSize(fetch.getFetchBatchSize())); if (rsType != ResultSet.TYPE_FORWARD_ONLY && fetch.getFetchDirection() != ResultSet.FETCH_FORWARD) stmnt.setFetchDirection(fetch.getFetchDirection()); } return stmnt; } catch (SQLException se) { try { stmnt.close(); } catch (SQLException se2) { } throw se; } }