@Override
	public Purchased findPurchasedByPK(Integer id) throws BusinessException {
		Purchased purchased=null;
		Connection connection=null;
		Statement statement=null;
		ResultSet resultSet=null;
		try {
			connection=dataSource.getConnection();
			String sql= "SELECT * FROM purchased WHERE purchased_id='"+id+"'";
			statement=connection.createStatement();
			resultSet=statement.executeQuery(sql);
			if (resultSet.next()) {
			//  Date orderDate=resultSet.getDate("order_date");     da vedere, intanto:
				Date orderDate=null;
				double price=resultSet.getDouble("price");
				int score=resultSet.getInt("score");
				Product product= new Product(resultSet.getInt("product_id"));
				User buyer=new User(resultSet.getString("username"));
				Review review=new Review(resultSet.getInt("review_id"));
				purchased=new Purchased(id, product, buyer, review, orderDate, price, score);
			}
		}  catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new BusinessException();
		} finally {
			if (resultSet != null) {
				try {
					resultSet.close();
				} catch (SQLException e) {
				}
			}
			if (statement != null) {
				try {
					statement.close();
				} catch (SQLException e) {
				}
			}
			if (connection != null) {
				try {
					connection.close();
				} catch (SQLException e) {
				}
			}
		}
		return purchased;
	}