@Override
	public Device getDeviceByID(int id) {
		Connection conn = null;
		PreparedStatement st = null;
		ResultSet row = null;
		try {
			conn = OracleDAOFactory.createConnection();
			st = conn.prepareStatement(GET_DEVICE_BY_ID);
			st.setInt(1, id);
			row = st.executeQuery();
			Device dev = null;
			if (row.next()){
				dev = new Device();
				dev.setId(row.getInt(ID_DEVICE));
				dev.setIdComponent(row.getInt(ID_COMPONENT));
				dev.setIdPrev(row.getInt(ID_PREV));
				dev.setTitle(row.getString(TITLE));
			}else{
				throw new NoSuchDeviceException("No such device in database!");
			}			
			return dev;
		} catch (SQLException e) {
			throw new ShopException("Can't show device from database", e);
		} finally {
			try {
				if (row != null) {
					row.close();
				}
			} catch (SQLException e) {
				throw new ShopException(CANT_CLOSE_RESULT_SET, e);
			}
			
			try {
				if (st != null) {
					st.close();
				}
			} catch (SQLException e) {
				throw new ShopException(CANT_CLOSE_STATEMENT, e);
			}

			try {
				if (conn != null) {
					conn.close();
				}
			} catch (SQLException e) {
				throw new ShopException(CANT_CLOSE_CONNECTION, e);
			}
		}
	}