* @see org.xooof.xooofoscope.dao.IFamousPlaceDAO#exist(java.lang.Integer)
*/
public SFamousPlace fetchByPK(Integer famousPlaceId) throws DAOException {
if (famousPlaceId == null) {
throw new FamousPlaceDAOException("famousPlaceId cannot be null");
}
SFamousPlace famousPlace = null;
PreparedStatement statement = null;
ResultSet result;
Connection connection = DAOHelper.getDBConnection();
try {
try
{
statement = connection.prepareStatement(FETCHBYPK_QRY);
statement.setInt(1, famousPlaceId.intValue());
result = statement.executeQuery();
if(result.next())
{
famousPlace = new SFamousPlace();
famousPlace.setObjId(result.getString("id"));
famousPlace.setObjClass(SFamousPlace.class.getName());
famousPlace.setName(result.getString("name"));
famousPlace.setDescr(result.getString("description"));
famousPlace.setRa(result.getBigDecimal("ra"));
famousPlace.setDec(result.getBigDecimal("dec"));
if(result.next())
{
throw new FamousPlaceDAOException("Multiple rows exists for famousPlaceId " + famousPlaceId.toString());
}
}
else {
famousPlace = null;
}
}
catch(SQLException exc)
{
throw new FamousPlaceDAOException(exc.getMessage());
}//End catch IOException
}
// This code is to be executed each time in order to release DB Connections
finally
{