@Override
	public List<Purchased> findAllPurchasedByUser(User buyer)
			throws BusinessException {
		
		List<Purchased> results=new ArrayList<Purchased>();
		Connection connection=null;
		Statement statement=null;
		ResultSet resultSet=null;
		try {
			connection=dataSource.getConnection();
			String sql= "SELECT * FROM purchased WHERE username='"+buyer.getUsername()+"'";
			statement=connection.createStatement();
			resultSet=statement.executeQuery(sql);
			while (resultSet.next()) {
				Integer purchasedId=resultSet.getInt("purchased_id");
			//	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"));
				Review review=new Review(resultSet.getInt("review_id"));
				Purchased purchased=new Purchased(purchasedId, product, buyer, review, orderDate, price, score);
				results.add(purchased);
			}
		}  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 results;
		
	}