public Pallet getNextPalletToProduce() {
		String sql = 
		"select Pallets.*"+
		"from Pallets, Orders "+
		"where Pallets.orderId = Orders.id and Pallets.creationDateAndTime is NULL "+
		"ORDER BY requestedDeliveryDate ASC "+
		"LIMIT 1 ";

		PreparedStatement ps = null;
		try {
			ps = conn.prepareStatement(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		Pallet rtn = null;
		try {
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				rtn = extractPallet(rs);
				
			}
		} catch (SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} finally {
			if(ps != null)
				try {
					ps.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		}
		return rtn;
	}