Package com.avaje.tests.model.basic

Examples of com.avaje.tests.model.basic.Address


        .findList();

    Assert.assertTrue(list.size() > 1);

    for (Customer customer : list) {
      Address billingAddress = customer.getBillingAddress();
      if (billingAddress != null) {
        billingAddress.getLine1();
      }
      Address shippingAddress = customer.getShippingAddress();
      if (shippingAddress != null) {
        shippingAddress.getLine1();
      }
      List<Contact> contacts = customer.getContacts();
      for (Contact contact : contacts) {
        contact.getFirstName();
      }
View Full Code Here


public class TestElGetReference extends TestCase {

 
  public void test() {
   
    Address a = new Address();
    a.setId((short)12);
    a.setLine1("line1");
    a.setCity("Auckland");
   
    Customer c0 = new Customer();
    c0.setBillingAddress(a);

    Customer c1 = new Customer();
View Full Code Here

    // this invokes lazy loading on a property that is
    // not one of the selected ones (name, status) ... and
    // therefore the lazy load query selects all properties
    // in the customer (not just name and status)
    Address billingAddress = customer.getBillingAddress();

    Assert.assertNotNull(billingAddress);

    List<Order> list = Ebean.find(Order.class).fetch("customer", "name", new FetchConfig().lazy(5))
        .fetch("customer.contacts", "contactName, phone, email").fetch("customer.shippingAddress")
View Full Code Here

      order.getOrderDate();
      order.getShipDate();
      // order.setShipDate(new Date(System.currentTimeMillis()));
      Customer customer = order.getCustomer();
      customer.getName();
      Address shippingAddress = customer.getShippingAddress();
      if (shippingAddress != null) {
        shippingAddress.getLine1();
        shippingAddress.getCity();
      }
      // customer.getContacts()
    }

    SpiQuery<?> sq = (SpiQuery<?>) q;
View Full Code Here

    Customer customer = order.getCustomer();
    Assert.assertNotNull(customer);
    Assert.assertNotNull(customer.getName());

    Address address = customer.getBillingAddress();
    Assert.assertNotNull(address);
    Assert.assertNotNull(address.getCity());
  }
View Full Code Here

    Assert.assertTrue(beanStateCustomer.getLoadedProps().contains("status"));
    Assert.assertFalse(beanStateCustomer.getLoadedProps().contains("billingAddress"));

    customer.getName();

    Address billingAddress = customer.getBillingAddress();
    System.out.println(billingAddress);
    billingAddress.getLine1();

    Assert.assertTrue(list.size() > 0);

  }
View Full Code Here

    // this invokes lazy loading on a property that is
    // not one of the selected ones (name, status) ... and
    // therefore the lazy load query selects all properties
    // in the customer (not just name and status)
    Address billingAddress = customer.getBillingAddress();

    Assert.assertNotNull(billingAddress);
  }
View Full Code Here

      .setMaxRows(40)
      .findList();
   
    for (Order order : orders) {
      Customer customer = order.getCustomer();
      Address billingAddress = customer.getBillingAddress();
      if (billingAddress != null) {
        billingAddress.getCity();
      }
      Address shippingAddress = customer.getShippingAddress();
      if (shippingAddress != null) {
        shippingAddress.getCity();
      }
      List<OrderDetail> details = order.getDetails();
      for (OrderDetail orderDetail : details) {
        orderDetail.getUnitPrice();
        orderDetail.getProduct().getName();
View Full Code Here

   
    Customer customer = order.getCustomer();
    Assert.assertTrue(Ebean.getBeanState(customer).isReadOnly());
   
    Address billingAddress = customer.getBillingAddress();
    Assert.assertTrue(Ebean.getBeanState(billingAddress).isReadOnly());
   
   
    List<OrderDetail> details = order.getDetails();
    BeanCollection<?> bc = (BeanCollection<?>)details;
View Full Code Here

    Assert.assertFalse(loadedProps.contains("status"));
   
    cust1.getStatus();
   
    // a readOnly reference
    Address billingAddress = cust1.getBillingAddress();
    BeanState billAddrState = Ebean.getBeanState(billingAddress);
    Assert.assertTrue(billAddrState.isReference());
    Assert.assertTrue(billAddrState.isReadOnly());
   
    // lazy load .. no longer a reference
    billingAddress.getCity();
    Assert.assertFalse(billAddrState.isReference());
   
  }
View Full Code Here

TOP

Related Classes of com.avaje.tests.model.basic.Address

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.