etLogger (DishDaoImpl.class.getName ()). log (Level.SEVERE, null, ex); return false;
}} boolean editDish (Dish dish) {{statement=(PreparedStatement) dbConnection.connect (). prepareStatement (Dish.getMap (). get ( updateDish )) ;. setString (1, dish.getName ( )) ;. setDouble (2, dish.getWeight ()) ;. setDouble (3, dish.getPrice ()) ;. setInt (4, dish.getId ()); (statement.executeUpdate () gt; 0);
} catch (SQLException ex) {.getLogger (DishDaoImpl.class.getName ()). log (Level.SEVERE,
, ex);
return false;
}
} List lt; Dish gt; selectDishes () {theSet; lt; Dish gt; dishList=null; {ps=(PreparedStatement) dbConnection.connect (). (Dish.getMap (). get ( selectAll ));=ps.executeQuery ();=new ArrayList lt; Dish gt; (); (theSet.next ()) {dish=new Dish (); (dish, theSet) ;. add (dish);
} dishList;
} catch (SQLException ex) {.getLogger (DishDaoImpl.class.getName ()). log (Level.SEVERE, null, ex); null;
}
} ArrayList lt; Dish gt; selectDishesByDishType (String dishType) {theSet; lt; Dish gt; dishList=new ArrayList lt; Dish gt; (); {ps=(PreparedStatement) dbConnection.connect (). (Dish.getMap (). get ( selectByType )) ;. setString (1, dishType);=ps.executeQuery (); (theSet.next ()) {dish=new Dish (); (dish, theSet) ;. add (dish);
} dishList;
} catch (SQLException ex) {.getLogger (DishDaoImpl.class.getName ()). log (Level.SEVERE, null, ex); null;
}
} List lt; DishComposition gt; selectDishCompositionByDishId (int dishId) {theSet; lt; DishComposition gt; productsList=new ArrayList lt; DishComposition gt; (); {ps=(PreparedStatement) .connect (). (Dish.getMap (). get ( selectCompositionByDishId )) ;. setInt (1, dishId);=ps.executeQuery ( ); (theSet.next ()) {composition=new DishComposition();.setProductName(theSet.getString(laquo;nameProductraquo;));.setProductWeight(theSet.getInt(laquo;productWieghtInDishCompositionraquo;));.add(composition);
}
} catch (SQLException ex) {.getLogger (DishDaoImpl.class.getName ()). log (Level.SEVERE, null, ex);
} return productsList; }}
()
DATABASE IF NOT EXISTS `restaurant` TABLE IF NOT EXISTS` admin` (
`idadmin` int (11) NOT NULL AUTO_INCREMENT,
`loginadmin` varchar (45) NOT NULL,
`passwordadmin` int (11) NOT NULL, KEY (` idadmin`), KEY `loginAdmin_UNIQUE` (` loginadmin`), KEY `idadmin_UNIQUE` (` idadmin`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; INTO `admin` (` idadmin`, `loginadmin`,` passwordadmin`) VALUES (1, admin raquo ;, 92668751), (7, olya raquo ;, 1450575459), (8, kostya raquo ;, 1508416), (9, kolya raquo ;, 1824529005); TABLE IF NOT EXISTS `basket` ??(
`dishCountBasket` ??int (11) NOT NULL,
`dish_idDish` int (11) NOT NULL,
`order_idOrder` int (11) NOT NULL, KEY (` dish_idDish`, `order_idOrder`),` fk_basket_order1` (`order_idOrder`),` fk_basket_dish` FOREIGN KEY (`dish_idDish`) REFERENCES` dish` (`idDish `) ON DELETE NO ACTION ON UPDATE NO ACTION,` fk_basket_order1` FOREIGN KEY (`order_idOrder`) REFERENCES` order` (`idOrder`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8; TABLE IF NOT EXISTS `client` (
`idClient` int (11) NOT NULL AUTO_INCREMENT,
`lastnameClient` varchar (45) NOT NULL,
`firstnameClient` varchar (45) NOT NULL,
`addressClient` varchar (45) NOT NULL,
`phoneClient` varchar (45) NOT NULL, KEY (` idClient`), KEY `idClient_UNIQUE` (` idClient`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; INTO `client` (` idClient`, `lastnameClient`,` firstnameClient`, `addressClient`,` phoneClient`) VALUES (1, raquo ;, laquo ; raquo ;, 58-110 raquo ;, 3070330 ), (10, raquo ;, raquo ;, 23-89 raquo ;, 2456791 ), (11, , raquo ;, 23-90 raquo ;, 1243546 ), (13, raquo ;, raquo ;, 34-123 raquo ;, 1234565 ), (22, raquo ;, raquo ;, 7 raquo ;, 2345645 ); TABLE IF NOT EXISTS `composition` (
`productWieghtInDishComposition` int (11) NOT NULL,
`caloriesComposition` varchar (45) NOT NULL,
`dish_idDish` int (11) NOT NULL,
`product_idProduct` int (11) NOT NULL, KEY (` dish_idDish`, `product_idProduct`),` fk_composition_product1` (`product_idProduct`),` fk_composition_dish1` FOREIGN KEY (`dish_idDish`) REFERENCES` dish` (`idDish `) ON DELETE NO ACTION ON UPDATE NO ACTION,` fk_composition_product1` FOREIGN KEY (`product_idProduct`) REFERENCES` product` (`idProduct`) ON DELETE NO ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INTO `composition` (` productWieghtInDishComposition`, `caloriesComposition`,` dish_idDish`, `product_idProduct`) VALUES (230, 50 raquo ;, 1, 1), (137, 345 raquo ;, 1, 2) , (30, 120 raquo ;, 2, 3), (212, 234 raquo ;, 2, 4), (123, 234 raquo ;, 3, 1), (23, 32 r...