@Override
	public boolean create(Reservation x) 
	{
                String req = "INSERT INTO `reservation`("
                        + "`datedebut`, "
                        + "`datefin`, "
                        + "`particulierid`, "
                        + "`chambreid`"
                        + ") "
                        + "select "
                        +"\""+x.getDateDebut()+"\","
                        +"\""+x.getDateFin()+"\","
                        +x.getParticulierId()+","
                        +x.getChambreId() +" from dual "
                        
                        //On  insert pas si il y a un conflit avec une autre reservation.
                        +" where not exist("
                                    + " SELECT * FROM reservation "
                                    //Il y a un conflit si la reservation commence au milieu de la periode
                                    + " WHERE  ("
                                            + " datedebut> "+x.getDateDebut()
                                            + " AND datedebut< "+x.getDateFin()
                                        //ou si elle finit au millieu
                                        + " OR  "
                                            + " datefin> "+x.getDateDebut()
                                            + " AND datefin< "+x.getDateFin()
                                        //ou si la periode est entierement incluse dans le temps de la reservation
                                        + " OR  "
                                            + " datedebut <= "+x.getDateDebut()
                                            + " AND dateFin >= "+x.getDateFin()
                        + ")";
	Statement stm = null;
		try 
		{
			stm = cnx.createStatement(); 
			int n= stm.executeUpdate(req,Statement.RETURN_GENERATED_KEYS);
			if (n>0)
			{
                                x.setReservationId(n);
				stm.close();
				return true;
			}
		}
		catch (SQLException exp)
		{
                    System.out.print(exp);
		}
		finally
		{
			if (stm!=null)
			try {
				stm.close();
			} catch (SQLException e) {
				e.printStackTrace(); 
			}			
		}

		return false;
	}