@Test
public void Query() throws IOException {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.addClass(TEST.NS, Person.class).addId("id").addProperties();
builder.addClass(new UID(TEST.NS, "Dept"), Department.class).addId("id").addProperties();
builder.addClass(TEST.NS, Company.class).addId("id").addProperties();
Configuration configuration = builder.build();
Session session = SessionUtil.openSession(new MiniRepository(), Collections.<Locale> emptySet(), configuration);
Person person = new Person();
person.firstName = "Bob";
person.lastName = "Smith";
session.save(person);
session.clear();
Person other = session.getById(person.id, Person.class);
assertNotNull(other.id);
assertEquals(person.firstName, other.firstName);
assertEquals(person.lastName, other.lastName);
PathBuilder<Person> personPath = new PathBuilderFactory().create(Person.class);
assertEquals(other, session.from(personPath).where(personPath.getString("firstName").eq("Bob")).uniqueResult(personPath));
assertEquals(other, session.from(personPath).where(personPath.getString("lastName").eq("Smith")).uniqueResult(personPath));
assertEquals(1, session.from(personPath).list(personPath).size());
assertEquals(1, session.findInstances(Person.class).size());
session.close();
}