Examples of CustomerRemote


Examples of com.ibm.demo.entity.CustomerRemote

    }
   
    List granted = new ArrayList();
   
    //loop through all customers
    CustomerRemote customer = null;
    for (int i = 1; ; i++){
      Integer pk = new Integer(i);
      try{
        customer = customerHome.findByPrimaryKey(pk);
      } catch(FinderException fe){
        System.out.println("Find Exception: " + fe.getMessage());
        break;
      } catch(RemoteException re){
        System.out.println("Remote Exception: " + re.getMessage());
        break;
      }
      // Check to see if the annualSalary to loanAmount ratio is not acceptable (<0.1)
     
      try{
        double ratio = customer.getAnnualSalary().doubleValue() / customer.getLoanAmount().doubleValue();
        if((customer != null)&&(ratio < 0.1)){
          granted.add(customer.getName());
        }
      }catch (RemoteException re){
        System.out.println("Remote Exception: " + re.getMessage());
      }
    }
View Full Code Here

Examples of com.ibm.demo.entity.CustomerRemote

   */
  public void submitLoanApplication(Integer id, String name, String address, Date birthdate,
                    String sssNo, Double annualSalary, Double loanAmount) {
   
    CustomerHomeRemote customerHome = null;
    CustomerRemote customer = null;
   
    try{
      Context jndiContext = new InitialContext();
      Object obj = jndiContext.lookup("java:comp/env/ejb/CustomerHomeRemote");

View Full Code Here

Examples of com.ibm.demo.entity.CustomerRemote

   */
  public int getMaxPK(){
    int maxPK = 0;
   
    CustomerHomeRemote customerHome = null;
    CustomerRemote customer = null;
   
    try{
      Context jndiContext = new InitialContext();
      Object obj = jndiContext.lookup("java:comp/env/ejb/CustomerHomeRemote");

View Full Code Here

Examples of com.ibm.demo.entity.bmp.CustomerRemote

                Context initial = new InitialContext();
                NamingEnumeration n = initial.list(initial.getNameInNamespace());
                while(n.hasMoreElements()) System.out.println(n.next());
                Object objref = initial.lookup("java:comp/env/CustomerHomeRemote");
                CustomerHomeRemote home = (CustomerHomeRemote) PortableRemoteObject.narrow(objref,CustomerHomeRemote.class);
                CustomerRemote customer = home.create(new Integer(txtMsg.getIntProperty("customerID")),txtMsg.getStringProperty("customerName"),
                    txtMsg.getStringProperty("customerSSS"),txtMsg.getStringProperty("customerAddress"), new SimpleDateFormat("mm/dd/yyyy").parse(txtMsg.getStringProperty("birthdate")),
            new Double(txtMsg.getDoubleProperty("customerSalary")),new Double(txtMsg.getDoubleProperty("customerLoan")));
                logger.info("SUCCESS!!!");
               
            } else {
View Full Code Here

Examples of com.titan.customer.CustomerRemote

            // create Customers
            for(int i = 0; i < args.length; i++) {
                Integer primaryKey = new Integer(args[i]);
                String firstName = args[++i];
                String lastName = args[++i];
                CustomerRemote customer = home.create(primaryKey);
                customer.setFirstName(firstName);
                customer.setLastName(lastName);
                customer.setHasGoodCredit(true);
            }

            // find and remove Customers
            for(int i = 0; i < args.length; i+=3) { 
                Integer primaryKey = new Integer(args[i]);
                CustomerRemote customer = home.findByPrimaryKey(primaryKey);
                String lastName = customer.getLastName( );
                String firstName = customer.getFirstName( );
                System.out.print(primaryKey+" = ");
                System.out.println(firstName+" "+lastName);

                // remove Customer
                customer.remove();
            }
           

        } catch (java.rmi.RemoteException re){re.printStackTrace();}
          catch (Throwable t){t.printStackTrace();}
View Full Code Here

Examples of com.titan.customer.CustomerRemote

          javax.rmi.PortableRemoteObject.narrow(obj, CustomerHomeRemote.class);

        System.out.println("Creating Customer 1..");
        // create a Customer
        Integer primaryKey = new Integer(1);
        CustomerRemote customer = home.create(primaryKey);
        
        // create an address data object
        System.out.println("Creating AddressDO data object..");
        AddressDO address = new AddressDO(new Integer(10),"1010 Colorado"
                      "Austin", "TX", "78701");
       
        // set address in Customer bean
        System.out.println("Setting Address in Customer 1...");
        customer.setAddress(address);
        
        System.out.println("Acquiring Address data object from Customer 1...");
        address = customer.getAddress();

        System.out.println("Customer 1 Address data: ");
        System.out.println(address.getStreet( ));
        System.out.println(address.getCity( )+","+
                address.getState()+" "+
                address.getZip());
                         
                 
        // create a new address
        System.out.println("Creating new AddressDO data object..");
        address = new AddressDO(new Integer(20),"1600 Pennsylvania Avenue NW"
                    "DC", "WA", "20500");
                   
        // change customer's address
        System.out.println("Setting new Address in Customer 1...");
        customer.setAddress(address);

        address = customer.getAddress();
        System.out.println("Customer 1 Address data: ");
        System.out.println(address.getStreet( ));
        System.out.println(address.getCity( )+","+
                address.getState()+" "+
                address.getZip());
         
         
        // remove Customer to clean up
        System.out.println("Removing Customer 1...");
        customer.remove();
    }
    catch( Exception ex )
    {
        ex.printStackTrace();
        throw ex;
View Full Code Here

Examples of com.titan.customer.CustomerRemote

      javax.rmi.PortableRemoteObject.narrow(obj, CustomerHomeRemote.class);

    System.out.println("Creating Customer 1..");
    // create a Customer
    Integer primaryKey = new Integer(1);
    CustomerRemote customer = home.create(primaryKey);
    
    // create an address data object
    System.out.println("Creating AddressDO data object..");
    AddressDO address = new AddressDO("1010 Colorado"
                    "Austin", "TX", "78701");
   
    // set address in Customer bean
    System.out.println("Setting Address in Customer 1...");
    customer.setAddress(address);
    
    System.out.println("Acquiring Address data object from Customer 1...");
    address = customer.getAddress();

    System.out.println("Customer 1 Address data: ");
    System.out.println(address.getStreet( ));
    System.out.println(address.getCity( )+","+
               address.getState()+" "+
View Full Code Here

Examples of com.titan.customer.CustomerRemote

    // create example customer
    System.out.println("Creating customer for use in example...");
    Integer primaryKey = new Integer(1);
    Name name = new Name("Monson", "Richard");
    CustomerRemote customer = home.create(primaryKey);
    customer.setName(name);

    // find Customer by key
    System.out.println("Getting name of customer using getName()..");
    customer = home.findByPrimaryKey(primaryKey);
    name = customer.getName();
    System.out.print(primaryKey+" = ");
    System.out.println(name.getFirstName( )+" "+name.getLastName( ));
               
    // change customer's name
    System.out.println("Setting name of customer using setName()..");
    name = new Name("Monson-Haefel", "Richard");
    customer.setName(name);
    System.out.println("Getting name of customer using getName()..");
    name = customer.getName();
    System.out.print(primaryKey+" = ");
    System.out.println(name.getFirstName( )+" "+name.getLastName( ));

    // remove Customer to clean up
    System.out.println("Removing customer...");
    customer.remove();
                System.exit(0);
               
    }
View Full Code Here

Examples of org.jboss.tutorial.hibernate.bean.CustomerRemote

{

   public static void main(String args[]) throws Exception
   {
      Context ctx = new InitialContext();
      CustomerRemote customerBean = (CustomerRemote) ctx.lookup("CustBean");
      // let's create customer#1
      long id = customerBean.createCustomer("Jai", "Pai");
      System.out.println("Jai Pai created with id = " + id);

      //let's create customer#2
      long custId2 = customerBean.createCustomer("Jaikiran", "Pai");
      System.out.println("Jaikiran Pai created with id = " + custId2);

      //one more customer
      long custId3 = customerBean.createCustomer("Jai", "NoLastName");
      System.out.println("Jai NoLastName created with id = " + custId3);

      // now let's find customer with some specific id
      System.out.println("Searching for customer with id = " + custId2);
      Customer customer = customerBean.getCustomer(custId2);
      System.out.println("Found customer " + customer.getFname() + " " + customer.getLname() + " with id = " + custId2);

     
      //let's use the other bean to search another customer
      CustomerRemote anotherCustomerBean = (CustomerRemote) ctx.lookup("AnotherCustBean");
      System.out.println("Searching for customer with id = " + custId3);
      Customer oneMoreCustomer = anotherCustomerBean.getCustomer(custId3);
      System.out.println("Found customer " + oneMoreCustomer.getFname() + " " + oneMoreCustomer.getLname() + " with id = " + custId3);

      // now let's find customers with first name=Jai
      System.out.println("Searching for customers with first name Jai");
      List<Customer> customers = customerBean.getCustomers("Jai");
      System.out.println("Found " + customers.size() + " customers with first name Jai");
     
      // let's use the other bean to find customers with name Jaikiran
      System.out.println("Searching for customers with first name Jaikiran");
      List<Customer> moreCustomers = anotherCustomerBean.getCustomers("Jaikiran");
      System.out.println("Found " + moreCustomers.size() + " customers with first name Jaikiran");
     

   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.