use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldObtainQueryResultsWithStatistics.
@Test
public void shouldObtainQueryResultsWithStatistics() {
session.save(new User("Bilbo Baggins"));
session.save(new User("Frodo Baggins"));
session.clear();
Result result = session.query("MATCH (u:User) WHERE u.name =~ '.*Baggins' SET u.species = 'Hobbit' RETURN u.name", Collections.emptyMap());
assertThat(result.queryStatistics().getPropertiesSet()).isEqualTo(2);
assertThat(result.iterator().hasNext()).isTrue();
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method m2.
private void m2() {
// inner transaction commits (defers commit)
try (Transaction tx = session.beginTransaction()) {
session.save(new User());
tx.commit();
}
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldQueryForObject.
// query tests
@Test
public void shouldQueryForObject() {
session.save(new User("Bilbo Baggins"));
session.clear();
User bilbo = session.queryForObject(User.class, "MATCH(u:User) RETURN u", Collections.singletonMap("name", "Bilbo Baggins"));
assertThat(bilbo).isNotNull();
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldObtainEmptyQueryResultsWithStatistics.
@Test
public void shouldObtainEmptyQueryResultsWithStatistics() {
session.save(new User("Bilbo Baggins"));
session.save(new User("Frodo Baggins"));
session.clear();
Result result = session.query("MATCH (u:User) WHERE u.name =~ '.*Baggins' SET u.species = 'Hobbit'", Collections.emptyMap());
assertThat(result.queryStatistics().getPropertiesSet()).isEqualTo(2);
assertThat(result.iterator().hasNext()).isFalse();
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldLoadByIds.
@Test
public void shouldLoadByIds() {
User bilbo = new User("Bilbo Baggins");
User frodo = new User("Frodo Baggins");
session.save(bilbo);
session.save(frodo);
session.clear();
Collection<User> userByInstances = session.loadAll(User.class, Arrays.asList(frodo.getId(), bilbo.getId()));
assertThat(userByInstances).isNotNull();
assertThat(userByInstances).hasSize(2);
}
Aggregations