Package com.orientechnologies.orient.test.domain.business

Examples of com.orientechnologies.orient.test.domain.business.Address


  public void testReloadAndDetachAll() {
    // DELETE PREVIOUS TEST DATA
    database.command(new OCommandSQL("delete from Profile where nick = 'Jack'")).execute();
    // Open db
    // Create the address without country
    Address anAddress = new Address("Godewaersvelde");
    anAddress = database.save(anAddress);
    Address realAddress = database.detachAll(anAddress, true);
    // Create the person
    Profile aPerson = new Profile("Jack", "Jack", "Black", null);
    aPerson.setLocation(realAddress);
    aPerson = database.save(aPerson);
    // Update the address by another way (another process for example)
    City aCity = new City("Paris");
    aCity = database.save(aCity);
    String command = "update " + anAddress.getId() + " set city = " + database.getIdentity(aCity);
    database.command(new OCommandSQL(command)).execute();
    realAddress = database.reload(anAddress, true);
    Assert.assertNotNull(realAddress.getCity());
    // At this point, in OrientDB Studio everything is fine
    // The address has the good country @rid, with version +1
    // Now reload and detachAll the person
    Profile newPerson = database.reload(aPerson, "*:-1", true);
    Profile finalPerson = database.detachAll(newPerson, true);
View Full Code Here


    Company company;

    for (long i = startRecordNumber; i < startRecordNumber + TOT_RECORDS; ++i) {
      company = database.newInstance(Company.class, (int) i, "Microsoft" + i);
      company.setEmployees((int) (100000 + i));
      company.getAddresses().add(new Address("Headquarter", redmond, "WA 98073-9717"));
      database.save(company);
    }
  }
View Full Code Here

    Assert.assertEquals(loadedJavaObj.enumMap.get("2"), EnumTest.ENUM3);
  }

  public void testReloadAndDetachAll() {
    // Create the address without country
    Address anAddress = new Address("Godewaersvelde");
    anAddress = database.save(anAddress);
    Address realAddress = database.detachAll(anAddress, true);
    // Create the person
    Profile aPerson = new Profile("Jack", "Jack", "Black", null);
    aPerson.setLocation(realAddress);
    aPerson = database.save(aPerson);
    // Update the address by another way (another process for example)
    City aCity = new City("Paris");
    aCity = database.save(aCity);
    String command = "update " + anAddress.getId() + " set city = " + database.getIdentity(aCity);
    database.command(new OCommandSQL(command)).execute();
    realAddress = database.reload(anAddress, true);
    Assert.assertNotNull(realAddress.getCity());
    // At this point, in OrientDB Studio everything is fine
    // The address has the good country @rid, with version +1
    // Now reload and detachAll the person
    Profile newPerson = database.reload(aPerson, "*:-1", true);
    Profile finalPerson = database.detachAll(newPerson, true);
View Full Code Here

    for (long i = startRecordNumber; i < startRecordNumber + TOT_RECORDS; ++i) {
      account = new Account((int) i, "Bill", "Gates");
      account.setBirthDate(new Date());
      account.setSalary(i + 300.10f);
      account.getAddresses().add(new Address("Residence", rome, "Piazza Navona, 1"));
      database.save(account);
    }
  }
View Full Code Here

    Account a;
    for (Object o : database.browseCluster("Account").setFetchPlan("*:1")) {
      a = (Account) o;

      if (i % 2 == 0)
        a.getAddresses().set(0, new Address("work", new City(new Country("Spain"), "Madrid"), "Plaza central"));

      a.setSalary(i + 500.10f);

      database.save(a);

View Full Code Here

  @Test(dependsOnMethods = "testSaveMultiCircular")
  public void createLinked() {
    long profiles = database.countClass("Profile");

    Profile neo = new Profile("Neo").setValue("test").setLocation(
        new Address("residence", new City(new Country("Spain"), "Madrid"), "Rio de Castilla"));
    neo.addFollowing(new Profile("Morpheus"));
    neo.addFollowing(new Profile("Trinity"));

    database.save(neo);
View Full Code Here

    try {
      Account account = new Account();
      account.setName("John Grisham");
      account = database.save(account);

      Address address1 = new Address();
      address1.setStreet("Mulholland drive");

      Address address2 = new Address();
      address2.setStreet("Via Veneto");

      List<Address> addresses = new ArrayList<Address>();
      addresses.add(address1);
      addresses.add(address2);
      account.setAddresses(addresses);
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.test.domain.business.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.