Package com.emc.plants.persistence

Examples of com.emc.plants.persistence.Customer


      Inventory inv = em.find(Inventory.class, si.getID());
      OrderItem oi = new OrderItem(inv);
      oi.setQuantity(si.getQuantity());
      orderitems.add(oi);
    }
    Customer c = em.find(Customer.class, customerID);
    order = new Order(c, billName, billAddr1, billAddr2, billCity, billState, billZip, billPhone,
        shipName, shipAddr1, shipAddr2, shipCity, shipState, shipZip, shipPhone, creditCard,
        ccNum, ccExpireMonth, ccExpireYear, cardHolder, shippingMethod, orderitems)
   
    //em.getTransaction().begin();
View Full Code Here


   */
  public String verifyUserAndPassword(String customerID, String password)
  {
    // Try to get customer.
    String results = null;
    Customer customer = null;
   
    /*
     CustomerHome customerHome = (CustomerHome)
     Util.getEJBLocalHome("java:comp/env/ejb/Customer",
     com.ibm.websphere.samples.pbwjpa.CustomerHome.class);
    
     try
     {
     customer = customerHome.findByPrimaryKey(new CustomerKey(customerID));
     }
     catch (ObjectNotFoundException e) { }
     }
     catch (FinderException e) { e.printStackTrace(); }
     */
        EntityManager em = entityManagerFactory.createEntityManager();
    customer = em.find(Customer.class, customerID);
   
    // Does customer exists?
    if (customer != null)
    {
      if ( ! customer.verifyPassword(password) )    // Is password correct?
      {
        results = "\nPassword does not match for : " + customerID;
        Util.debug("Password given does not match for userid=" + customerID);
      }
    }
View Full Code Here

       }
       }
       catch (FinderException e) { e.printStackTrace(); }
       catch (CreateException e) { e.printStackTrace(); }
       */
    Customer c = new Customer(customerID, password, firstName, lastName, addr1, addr2,
        addrCity, addrState, addrZip, phone);
        EntityManager em = entityManagerFactory.createEntityManager();
        em.getTransaction().begin();
    em.persist(c);
    em.flush();
View Full Code Here

     customer.update(firstName, lastName, addr1, addr2, addrCity, addrState, addrZip, phone);
     customerInfo = new CustomerInfo(customer);
     */
        EntityManager em = entityManagerFactory.createEntityManager();
        em.getTransaction().begin();
    Customer c = em.find(Customer.class, customerID);
    em.lock(c, LockModeType.WRITE);
    em.refresh(c);
    // TODO: lowp: test and set for update performance?
    c.setFirstName(firstName);
    c.setLastName(lastName);
    c.setAddr1(addr1);
    c.setAddr2(addr2);
    c.setAddrCity(addrCity);
    c.setAddrState(addrState);
    c.setAddrZip(addrZip);
    c.setPhone(phone);
   
    customerInfo = new CustomerInfo(c);
    em.getTransaction().commit();
    return customerInfo;
  }
View Full Code Here

     Customer customer = customerHome.findByPrimaryKey(new CustomerKey(customerID));
     customerInfo = new CustomerInfo(customer);
     */
        EntityManager em = entityManagerFactory.createEntityManager();
        System.out.println(" Entity Manager :: "+em);
    Customer c = em.find(Customer.class, customerID);
    customerInfo = new CustomerInfo(c);
    return customerInfo;
   
  }
View Full Code Here

TOP

Related Classes of com.emc.plants.persistence.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.