Package openbook.domain

Examples of openbook.domain.Customer


        Integer stockMax = PropertyHelper.getInteger(config, "openbook.Inventory.Max", STOCK_RANGE.getMaximum());
        Integer stockMin = PropertyHelper.getInteger(config, "openbook.Inventory.Min", STOCK_RANGE.getMinimum());
       
        System.err.println("Creating " + nCustomer + " new Customer");
        for (int i = 1; i < nCustomer; i++) {
            Customer customer = new Customer();
            customer.setName("Customer-"+i);
            em.persist(customer);
        }

        List<Author> allAuthors = new ArrayList<Author>();
        System.err.println("Creating " + nAuthor + " new Authors");
View Full Code Here


    public Customer login(String name) {
        EntityManager em = begin();
       
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<Customer> q = cb.createQuery(Customer.class);
        Customer customer = null;
        Root<Customer> root = q.from(Customer.class);
        ParameterExpression<String> pName = cb.parameter(String.class);
        q.where(cb.equal(root.get(Customer_.name), pName));
        List<Customer> customers = em.createQuery(q)
          .setParameter(pName, name)
          .getResultList();
        if (customers.isEmpty()) {
            Customer newCustomer = new Customer();
            newCustomer.setName(name);
            em.persist(newCustomer);
            customer = newCustomer;
        } else {
            customer = customers.get(0);
        }
View Full Code Here

        Integer stockMax = PropertyHelper.getInteger(config, "openbook.Inventory.Max", STOCK_RANGE.getMaximum());
        Integer stockMin = PropertyHelper.getInteger(config, "openbook.Inventory.Min", STOCK_RANGE.getMinimum());
       
        System.err.println("Creating " + nCustomer + " new Customer");
        for (int i = 1; i < nCustomer; i++) {
            Customer customer = new Customer();
            customer.setName("Customer-"+i);
            em.persist(customer);
        }

        List<Author> allAuthors = new ArrayList<Author>();
        System.err.println("Creating " + nAuthor + " new Authors");
View Full Code Here

    public Customer login(String name) {
        EntityManager em = begin();
       
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<Customer> q = cb.createQuery(Customer.class);
        Customer customer = null;
        Root<Customer> root = q.from(Customer.class);
        ParameterExpression<String> pName = cb.parameter(String.class);
        q.where(cb.equal(root.get(Customer_.name), pName));
        List<Customer> customers = em.createQuery(q)
          .setParameter(pName, name)
          .getResultList();
        if (customers.isEmpty()) {
            Customer newCustomer = new Customer();
            newCustomer.setName(name);
            em.persist(newCustomer);
            customer = newCustomer;
        } else {
            customer = customers.get(0);
        }
View Full Code Here

TOP

Related Classes of openbook.domain.Customer

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.