use of org.neo4j.ogm.domain.linkedlist.Item in project neo4j-ogm by neo4j.
the class BidirectionalMappingTest method shouldHandleSelfReferencingObjectOnRollback.
@Test
public void shouldHandleSelfReferencingObjectOnRollback() {
Item item = new Item();
item.next = item;
item.previous = item;
try (Transaction tx = session.beginTransaction()) {
session.save(item);
session.deleteAll(Item.class);
}
}
use of org.neo4j.ogm.domain.linkedlist.Item in project neo4j-ogm by neo4j.
the class BidirectionalMappingTest method shouldLoadDoublyLinkedList.
/**
* @see DATAGRAPH-636
*/
@Test
public void shouldLoadDoublyLinkedList() {
Item first = new Item();
Item second = new Item();
Item third = new Item();
first.next = second;
second.next = third;
session.save(first);
session.clear();
first = session.load(Item.class, first.getId(), -1);
assertThat(first.next.getId()).isEqualTo(second.getId());
assertThat(first.next.next.getId()).isEqualTo(third.getId());
assertThat(first.next.next.next).isNull();
assertThat(first.previous).isNull();
assertThat(first.next.previous.getId()).isEqualTo(first.getId());
assertThat(first.next.next.previous.getId()).isEqualTo(second.getId());
}
Aggregations