Package nz.co.elysium.core

Examples of nz.co.elysium.core.PizzaDAO


    @Override
    protected void run(Environment environment, Namespace namespace, PizzaConfiguration config) throws Exception {
        final DBIFactory factory = new DBIFactory();
        final DBI jdbi = factory.build(environment, config.getDatabaseConfiguration(), "postgresql");
        final ToppingDAO dao = jdbi.onDemand(ToppingDAO.class);
        final PizzaDAO pizza_dao = jdbi.onDemand(PizzaDAO.class);

        // toppings
        dao.deleteAll();
        long t_mushroom = dao.insert("Mushroom");
        long t_onion = dao.insert("Onion");
        long t_olive = dao.insert("Olives");
        long t_pineapple = dao.insert("Pineapple");
        long t_ham = dao.insert("Ham");
        long t_cheese = dao.insert("Cheese");

        // pizzas
        pizza_dao.deletePizza();
        pizza_dao.deletePizzaToppings();
        long p_hawaiian = pizza_dao.insert("Hawaiian", 1290);
        pizza_dao.insertTopping((int)p_hawaiian, (int)t_cheese);
        pizza_dao.insertTopping((int)p_hawaiian, (int)t_ham);
        pizza_dao.insertTopping((int)p_hawaiian, (int)t_pineapple);
        long p_vege = pizza_dao.insert("Vegetarian", 890);
        pizza_dao.insertTopping((int)p_vege, (int)t_cheese);
        pizza_dao.insertTopping((int)p_vege, (int)t_onion);
        pizza_dao.insertTopping((int)p_vege, (int)t_olive);
        pizza_dao.insertTopping((int)p_vege, (int)t_mushroom);
    }
View Full Code Here


    @Override
    public void run(PizzaConfiguration config, Environment environment) throws ClassNotFoundException {
        final DBIFactory factory = new DBIFactory();
        final DBI jdbi = factory.build(environment, config.getDatabaseConfiguration(), "postgresql");
        final ToppingDAO dao = jdbi.onDemand(ToppingDAO.class);
        final PizzaDAO pizza_dao = jdbi.onDemand(PizzaDAO.class);
        environment.addResource(new ToppingResource(dao));
        environment.addResource(new PizzaResource(pizza_dao));
    }
View Full Code Here

TOP

Related Classes of nz.co.elysium.core.PizzaDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.