public SInstrumentArrayList fetchByTelescopeId(Integer telescopeId) throws DAOException {
if (telescopeId == null) {
throw new InstrumentDAOException("telescopeId cannot be null");
}
SInstrumentArrayList instrumentList = new SInstrumentArrayList();
SInstrument instrument = null;
PreparedStatement statement = null;
ResultSet result;
Connection connection = DAOHelper.getDBConnection();
try {
try
{
statement = connection.prepareStatement(FETCHBYTELESCOPE_QRY);
statement.setInt(1, telescopeId.intValue());
result = statement.executeQuery();
while(result.next())
{
instrument = new SInstrument();
instrument.setObjId(result.getString("id"));
instrument.setObjClass(SInstrument.class.getName());
instrument.setTelescopeId(result.getString("telescope_id"));
instrument.setName(result.getString("name"));
instrument.setDescr(result.getString("description"));
instrumentList.add(instrument);
}
}
catch(SQLException exc)
{
throw new InstrumentDAOException(exc.getMessage());