Estou com esse erro, mas estou usando o setInt(xx) corretamente. E quandocoloco o valor fixo no sql do código recebo o erro
java.sql.SQLException: Parâmetro IN ou OUT ausente do índice:: 1
A classe query que eu uso é do framework interno, mas no final das contas o erro estoura no rs = stmt.executeQuery();
Alguma sugestão ??
public Collection findSchedule(DynaBean bean) throws RemoteException, SQLException, NamingException{
Connection con = null;
Query qy = null;
List list;
try {
con = getConnection();
qy = new Query(con);
Integer productionLineId = (Integer) bean.get("productionLineId");
Integer dias = (Integer) bean.get("dias");
String msName = (String) bean.get("msName");
Integer muId = (Integer) bean.get("muId");
//StringBuffer sql = new StringBuffer();
String sql =
" select distinct MS.MS_NAME as PROGRAM_NAME, "+
" (SELECT ENUM.ENUM_PT_DESC FROM ENUM_INTERFACE ENUM "+
" WHERE ENUM_NAME like '%MS_STATE' AND ENUM.ENUM_INT_VALUE = MS.MS_STATE) AS STATUS_MS, "+
" to_char(MS.MS_START_DATE, 'dd/mm/yyyy hh:mm:ss') as PROGRAMME_START_TIME, "+
" to_char(MS.MS_END_DATE, 'dd/mm/yyyy hh:mm:ss') as PROGRAMME_END_TIME, "+
" CT.COFFIN_TYPE_NAME "+
" from SCHEDULED_PHASE SP, "+
" SCHEDULED_SET SS, "+
" MANUFACTURING_SCHEDULE MS, "+
" COFFIN_ZONE CZ, "+
" COFFIN_TYPE CT "+
" where SP.SCHEDULED_SET_ID = SS.SCHEDULED_SET_ID "+
" AND SS.MANUFACTURING_SCHEDULE_ID = MS.MANUFACTURING_SCHEDULE_ID "+
" AND SS.COFFIN_ZONE_ID = CZ.COFFIN_ZONE_ID "+
" AND CT.COFFIN_TYPE_ID = CZ.COFFIN_TYPE_ID "+
" AND SP.MU_ID= ?"+
" order by MS.MS_NAME";
//1533601
qy.setSql(sql);
qy.prepare();
qy.setInt(1,muId );
qy.open();
list = new ArrayList();
FollowMuVO followMuVO;
while (!qy.isEof()) {
followMuVO = new FollowMuVO();
followMuVO.setPpId(qy.getString("PROGRAM_NAME"));
followMuVO.setEstadoPP(qy.getString("STATUS_MS"));
followMuVO.setTempoInicializacao(qy.getDate("PROGRAMME_START_TIME"));
followMuVO.setTempoFinal(qy.getDate("PROGRAMME_END_TIME"));
followMuVO.setTipoDeCone(qy.getString("COFFIN_TYPE_NAME"));
list.add(followMuVO);
qy.next();
}
return list;
}catch(SQLException e) {
e.printStackTrace();
throw e;
//return new ArrayList();
}
finally {
if (qy != null)
qy.close();
if (con != null)
con.close();
}
}