Advertisement
Guest User

CustomerController

a guest
Sep 30th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package org.cqu.budgetcars.controllers;
  7.  
  8. import java.util.List;
  9. import javax.ejb.EJB;
  10. import javax.inject.Named;
  11. import javax.enterprise.context.RequestScoped;
  12. import javax.persistence.EntityManager;
  13. import javax.persistence.EntityTransaction;
  14. import org.cqu.budgetcars.myentities.Customer;
  15. import org.cqu.budgetcars.myentities.mysessionbeans.CustomerEJB;
  16.  
  17. /**
  18.  *
  19.  * @author kenta
  20.  */
  21. @Named(value = "customerController")
  22. @RequestScoped
  23. public class CustomerController {
  24.    
  25.     @EJB
  26.     private CustomerEJB customerEJB;
  27.     private List<Customer> customers;
  28.     private Customer customer = new Customer();
  29.     /**
  30.      * Creates a new instance of CustomerController
  31.      */
  32.     public CustomerController() {
  33.     }
  34.     public String doCreate(){
  35.         customerEJB.create(customer);
  36.         return "listCustomers.xhtml";
  37.     }
  38.  
  39.     public CustomerEJB getCustomerEJB() {
  40.         return customerEJB;
  41.     }
  42.  
  43.     public void setCustomerEJB(CustomerEJB customerEJB) {
  44.         this.customerEJB = customerEJB;
  45.     }
  46.  
  47.     public List<Customer> getCustomers() {
  48.         return customers;
  49.     }
  50.  
  51.     public void setCustomers(List<Customer> customers) {
  52.         this.customers = customers;
  53.     }
  54.  
  55.     public Customer getCustomer() {
  56.         return customer;
  57.     }
  58.  
  59.     public void setCustomer(Customer customer) {
  60.         this.customer = customer;
  61.     }
  62.    
  63.    
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement