Package com.avaje.tests.model.basic

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


   
    query.findList();
    String sql = query.getGeneratedSql();
    Assert.assertTrue(sql.contains("where t0.kcustomer_id = ?"));
   
    Address b = new Address();
    b.setId((short)1);
   
    Query<Order> q2 = Ebean.find(Order.class)
      .where().eq("customer.billingAddress", b)
      .query();
   
View Full Code Here


  public void testJoinHierarchyAssocOne() {
   
    Ebean.createUpdate(Vehicle.class, "delete from vehicle");


    Address address = new Address();
    address.setLine1("Street");
    address.setLine2("Street");
    address.setCity("City");
   
    address.setCretime(new Timestamp(new Date().getTime()));
 
    Ebean.save(address);
   
    Car c = new Car();
    c.setLicenseNumber("C6788");
    c.setDriver("CarDriver");
    c.setRegistrationDate(new Date());
    Ebean.save(c);
   
    VehicleDriver driver = new VehicleDriver();
   
    driver.setVehicle(c);
    driver.setAddress(address);
    driver.setLicenseIssuedOn(new Date());
    Ebean.save(driver);
   
    final String line1 = "Street1";
    final String line2 = "Street2";
    final String city = "City";
   
    int nrDrivers = 2;
    for (int i = 0; i < nrDrivers;i++){
      Address address1 = new Address();
      address1.setLine1(line1);
      address1.setLine2(line2);
      address1.setCity(city);
      Ebean.save(address1);

      Trip trip = new Trip();
      trip.setVehicleDriver(driver);
      trip.setAddress(address1);
      trip.setCretime(new Timestamp(new Date().getTime()));
      Ebean.save(trip);
    }

    Ebean.beginTransaction();

    Query<Trip> q = Ebean.createQuery(Trip.class, "join address join vehicleDriver ");
   
    List<Trip> trips = q.findList();
   
    Assert.assertTrue(trips.size() == nrDrivers);
   
    for (Trip t:trips){
      Address a = t.getAddress();
      Assert.assertTrue(line1.equals(a.getLine1()));
      Assert.assertTrue(line2.equals(a.getLine2()));
      Assert.assertTrue(city.equals(a.getCity()));
    }
   
   
    Ebean.endTransaction();
  }
View Full Code Here

    c.setCretime(new Timestamp(System.currentTimeMillis()));
    c.setUpdtime(new Timestamp(System.currentTimeMillis()));
    c.setStatus(Status.ACTIVE);
    c.setSmallnote("somenote");
   
    Address billingAddress = new Address();
    billingAddress.setId((short)12);
    billingAddress.setCity("Auckland");
    billingAddress.setCountry(server.getReference(Country.class, "NZ"));
    billingAddress.setLine1("92 Someplace Else");
    c.setBillingAddress(billingAddress);
   
    ((EntityBean)c)._ebean_getIntercept().setNewBeanForUpdate();
   
    CachedBeanData cacheData = CachedBeanDataFromBean.extract(desc, (EntityBean)c);
View Full Code Here

   
    Set<String> loadedPropertyNames = ebi.getLoadedPropertyNames();
    Assert.assertNull(loadedPropertyNames);
   
    // no lazy loading expected here, value is null
    Address billingAddress = customer.getBillingAddress();
    Assert.assertNull(billingAddress);
   
    // assert only one query executed
    List<String> loggedSql = LoggedSqlCollector.stop();
    Assert.assertEquals(1,  loggedSql.size());
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.