protected void prepareStatementForExecution(PreparedStatement ps)
throws SQLException
{
OMFContext omfCtx = om.getOMFContext();
MappedStoreManager storeMgr = (MappedStoreManager)omfCtx.getStoreManager();
PersistenceConfiguration conf = omfCtx.getPersistenceConfiguration();
// Apply any user-specified timeout
int timeout = conf.getIntProperty("org.jpox.query.timeout");
Object timeoutExt = query.getExtension("org.jpox.query.timeout");
if (timeoutExt != null)
{
// Accept timeout as an Integer or String
if (timeoutExt instanceof Integer)
{
timeout = ((Integer)timeoutExt).intValue();
}
else if (timeoutExt instanceof String)
{
timeout = TypeConversionHelper.intFromString((String)timeoutExt, 0);
}
}
if (timeout > 0)
{
ps.setQueryTimeout(timeout);
}
// Apply any fetch size
int fetchSize = 0;
if (query.getFetchPlan().getFetchSize() > 0)
{
// FetchPlan has a size set so use that
fetchSize = query.getFetchPlan().getFetchSize();
}
if (storeMgr.getDatastoreAdapter().supportsQueryFetchSize(fetchSize))
{
ps.setFetchSize(fetchSize);
}
// Apply any fetch direction
String propName = "org.jpox.rdbms.query.fetchDirection";
String fetchDir = conf.getStringProperty(propName);
Object fetchDirExt = query.getExtension(propName);
if (fetchDirExt != null)
{
fetchDir = (String)fetchDirExt;
if (!fetchDir.equals("forward") && !fetchDir.equals("reverse") && !fetchDir.equals("unknown"))