Customer Insert

Insert a Customer with a Billing and Shipping Address


package app.dataorder.test;

import app.data.test.Address;
import app.data.test.Country;
import app.data.test.Customer;
import app.data.test.CustomerStatus;

import com.avaje.ebean.Ebean;

public class CustInsert {

    public static void main(String[] args) {
        
        Country nz = (Country)Ebean.getReference(Country.class, "NZ");
        
        Address ship = new Address();
        ship.setLine1("12 Queen St");
        ship.setCity("Auckland");
        ship.setCountry(nz);
        
        Address bill = new Address();
        bill.setLine1("PO Box 1234");
        bill.setCity("Auckland");
        bill.setCountry(nz);
        
        CustomerStatus statusNew = (CustomerStatus)Ebean.getReference(CustomerStatus.class, "A");
        Customer cust = new Customer();
        cust.setName("BigBox Exporters");
        cust.setBillingAddress(bill);
        cust.setShippingAddress(ship);
        cust.setStatus(statusNew);
        
        
        Ebean.save(cust);
        
    }
}

Transaction Log

This log was modified with line breaks.


 INFO, 17:46:15.015, Trans[1001] insert into or_address (city, cretime, line_1, 
       line_2, region, updtime, country_code) values (?, ?, ?, ?, ?, ?, ?) 
 INFO, 17:46:15.062, Trans[1001] Binding Insert [or_address]  set[city=Auckland,
       cretime=2006-11-28 17:46:15.046, line1=PO Box 1234, line2=null, region=null,
       updtime=2006-11-28 17:46:15.062, code=NZ, ] 
 INFO, 17:46:15.093, Trans[1001] Inserted [app.data.test.Address] [1] 
 INFO, 17:46:15.093, Trans[1001] insert into or_address (city, cretime, line_1,
       line_2, region, updtime, country_code) values (?, ?, ?, ?, ?, ?, ?) 
 INFO, 17:46:15.109, Trans[1001] Binding Insert [or_address]  set[city=Auckland,
       cretime=2006-11-28 17:46:15.109, line1=12 Queen St, line2=null, region=null,
       updtime=2006-11-28 17:46:15.109, code=NZ, ] 
 INFO, 17:46:15.109, Trans[1001] Inserted [app.data.test.Address] [2] 
 INFO, 17:46:15.109, Trans[1001] insert into or_customer (cretime, name, updtime,
       billing_address_id, shipping_address_id, status_code) values (?, ?, ?, ?, ?, ?) 
 INFO, 17:46:15.109, Trans[1001] Binding Insert [or_customer]  
       set[cretime=2006-11-28 17:46:15.109, name=BigBox Exporters, 
       updtime=2006-11-28 17:46:15.109, id=1, id=2, code=A, ] 
 INFO, 17:46:15.109, Trans[1001] Inserted [app.data.test.Customer] [1] 

Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements
woResponse