diff --git a/README.md b/README.md
index 1b0f28a..e0951a6 100644
--- a/README.md
+++ b/README.md
@@ -43,42 +43,42 @@ For the purpose of these instructions, we'll assume your new JIRA issue ID is "D
For [SDN 5.x](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/sdn-5.x) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh sdn-5.x DATAGRAPH-123
```
For [SDN 4.2](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/sdn-4.2) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh sdn-4.2 DATAGRAPH-123
```
For [SDN 4.1](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/sdn-4.1) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh sdn-4.1 DATAGRAPH-123
```
For [OGM 2.x](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/ogm-2.x) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh ogm-2.x issue-123
```
For [SDN with Spring Boot 1.5](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/boot-1.5) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh boot-1.5 DATAGRAPH-123
```
For [SDN with Spring Boot 1.4](https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template/tree/master/boot-1.4) issues:
```bash
-cd neo4j-ogm-bug-test-case-template
+cd neo4j-sdn-ogm-issue-report-template
./create-repro-project.sh boot-1.4 DATAGRAPH-123
```
@@ -97,7 +97,7 @@ git commit -m "Add repro project for DATAGRAPH-123"
git push
```
-5\. [Send a pull request from the Github web interface](http://help.github.com/send-pull-requests/)
+5\. [Send a pull request from the Github web interface](https://help.github.com/articles/creating-a-pull-request)
* The SDN team will be notified and will look at your request
diff --git a/issue-331/README.md b/issue-331/README.md
new file mode 100644
index 0000000..529d2b2
--- /dev/null
+++ b/issue-331/README.md
@@ -0,0 +1,14 @@
+# Repro project for issue-331
+
+## Configuring
+
+First, check out and update the versions in the `pom.xml` to match yours
+
+- the `neo4j-ogm.version`
+
+You can also override the version of Neo4j java drivers.
+
+## Logging
+
+This project contains a `logback-test.xml` file in `src/test/resources` that you
+may wish to configure to emit more detailed logging.
\ No newline at end of file
diff --git a/issue-331/pom.xml b/issue-331/pom.xml
new file mode 100644
index 0000000..2563a61
--- /dev/null
+++ b/issue-331/pom.xml
@@ -0,0 +1,61 @@
+
+
+ 4.0.0
+
+ issue-331
+ 1.0.0-SNAPSHOT
+ jar
+
+ Neo4j OGM 2.x Test Case Template
+ Use this template to report bugs with Neo4j OGM
+
+
+ org.neo4j.ogm.testcasetemplate
+ testcasetemplate
+ 1.0.0-SNAPSHOT
+ ../pom.xml
+
+
+
+
+
+ 2.1.1
+
+
+
+
+
+
+
+
+
+
+
+
+ org.neo4j
+ neo4j-ogm-core
+ ${neo4j-ogm.version}
+
+
+ org.neo4j
+ neo4j-ogm-http-driver
+ ${neo4j-ogm.version}
+ runtime
+
+
+ org.neo4j
+ neo4j-ogm-test
+ ${neo4j-ogm.version}
+ test
+
+
+ org.slf4j
+ slf4j-nop
+
+
+
+
+
+
+
diff --git a/issue-331/src/main/java/org/neo4j/ogm/test/domain/Friendship.java b/issue-331/src/main/java/org/neo4j/ogm/test/domain/Friendship.java
new file mode 100644
index 0000000..3082746
--- /dev/null
+++ b/issue-331/src/main/java/org/neo4j/ogm/test/domain/Friendship.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2002-2016 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This product is licensed to you under the Apache License, Version 2.0 (the "License").
+ * You may not use this product except in compliance with the License.
+ *
+ * This product may include a number of subcomponents with
+ * separate copyright notices and license terms. Your use of the source
+ * code for these subcomponents is subject to the terms and
+ * conditions of the subcomponent's license, as noted in the LICENSE file.
+ */
+
+package org.neo4j.ogm.test.domain;
+
+import java.util.Set;
+
+import org.neo4j.ogm.annotation.EndNode;
+import org.neo4j.ogm.annotation.RelationshipEntity;
+import org.neo4j.ogm.annotation.StartNode;
+
+/**
+ * @author Vince Bickers
+ */
+@RelationshipEntity(type = "FRIEND_OF")
+public class Friendship {
+
+ private Long id;
+
+ @StartNode
+ private Person person;
+
+ @EndNode
+ private Person friend;
+
+ private int strength;
+
+ private Set sharedHobbies;
+
+ public Friendship() {
+ }
+
+ public Friendship(Person from, Person to, int strength) {
+ this.person = from;
+ this.friend = to;
+ this.strength = strength;
+ }
+
+ public Friendship(Person person, Person friend, int strength, Set sharedHobbies) {
+ this.person = person;
+ this.friend = friend;
+ this.strength = strength;
+ this.sharedHobbies = sharedHobbies;
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public Person getFriend() {
+ return friend;
+ }
+
+ public int getStrength() {
+ return strength;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Set getSharedHobbies() {
+ return sharedHobbies;
+ }
+
+ public void setSharedHobbies(Set sharedHobbies) {
+ this.sharedHobbies = sharedHobbies;
+ }
+}
diff --git a/issue-331/src/main/java/org/neo4j/ogm/test/domain/Person.java b/issue-331/src/main/java/org/neo4j/ogm/test/domain/Person.java
new file mode 100644
index 0000000..89ef724
--- /dev/null
+++ b/issue-331/src/main/java/org/neo4j/ogm/test/domain/Person.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002-2016 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This product is licensed to you under the Apache License, Version 2.0 (the "License").
+ * You may not use this product except in compliance with the License.
+ *
+ * This product may include a number of subcomponents with
+ * separate copyright notices and license terms. Your use of the source
+ * code for these subcomponents is subject to the terms and
+ * conditions of the subcomponent's license, as noted in the LICENSE file.
+ */
+
+package org.neo4j.ogm.test.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.neo4j.ogm.annotation.Relationship;
+
+/**
+ * @author Vince Bickers
+ */
+public class Person {
+
+ private Long id;
+ private String name;
+
+ @Relationship(type = "FRIEND_OF")
+ private List friends;
+
+ public Person() {
+ this.friends = new ArrayList<>();
+ }
+
+ public Person(String name) {
+ this();
+ this.name = name;
+ }
+
+ public List getFriends() {
+ return friends;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Friendship addFriend(Person newFriend) {
+ Friendship friendship = new Friendship(this, newFriend, 5);
+ this.friends.add(friendship);
+ return friendship;
+ }
+
+}
diff --git a/issue-331/src/main/java/org/neo4j/ogm/test/domain/User.java b/issue-331/src/main/java/org/neo4j/ogm/test/domain/User.java
new file mode 100644
index 0000000..d1e729c
--- /dev/null
+++ b/issue-331/src/main/java/org/neo4j/ogm/test/domain/User.java
@@ -0,0 +1,39 @@
+package org.neo4j.ogm.test.domain;
+
+import org.neo4j.ogm.annotation.GraphId;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+@NodeEntity
+public class User {
+
+ @GraphId
+ private Long id;
+
+ private String firstName;
+
+ private String lastName;
+
+ private String email;
+
+ public User() {
+ // required by
+ }
+
+ public User(String email, String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.email = email;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+}
diff --git a/issue-331/src/test/java/org/neo4j/ogm/test/OgmTestCase.java b/issue-331/src/test/java/org/neo4j/ogm/test/OgmTestCase.java
new file mode 100644
index 0000000..d2ed2e9
--- /dev/null
+++ b/issue-331/src/test/java/org/neo4j/ogm/test/OgmTestCase.java
@@ -0,0 +1,75 @@
+package org.neo4j.ogm.test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.HashMap;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.neo4j.harness.junit.Neo4jRule;
+import org.neo4j.ogm.model.Result;
+import org.neo4j.ogm.session.Session;
+import org.neo4j.ogm.session.SessionFactory;
+import org.neo4j.ogm.test.domain.Person;
+import org.neo4j.ogm.test.domain.User;
+
+public class OgmTestCase {
+
+ @Rule
+ public Neo4jRule neoServer = new Neo4jRule();
+ private Session session;
+
+ @Before
+ public void setUp() throws Exception {
+
+ org.neo4j.ogm.config.Configuration configuration = new org.neo4j.ogm.config.Configuration();
+ configuration.driverConfiguration()
+ .setDriverClassName("org.neo4j.ogm.drivers.bolt.driver.BoltDriver")
+ .setURI(neoServer.boltURI().toString());
+// .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
+// .setURI(neoServer.httpURI().toString());
+
+ SessionFactory sessionFactory = new SessionFactory(configuration, User.class.getPackage().getName());
+ session = sessionFactory.openSession();
+ session.purgeDatabase();
+ }
+
+ @Test
+ public void unidirectionalRelationshipTest() {
+
+ Person dave = new Person("Dave");
+ Person mike = new Person("Mike");
+
+ dave.addFriend(mike);
+
+ session.save(dave);
+
+ // Assert that the relationship is unidirectional from Dave -> Mike and not Dave <- Mike
+ String cypherRelationshipCount = "match (n)<-[r:FRIEND_OF]-(m) return count(r) as relationshipCount";
+ Result result = session.query(cypherRelationshipCount, new HashMap());
+ long relationshipCount = (long) result.iterator().next().get("relationshipCount");
+ assertThat(relationshipCount == 0);
+ cypherRelationshipCount = "match (n)-[r:FRIEND_OF]->(m) return count(r) as relationshipCount";
+ result = session.query(cypherRelationshipCount, new HashMap());
+ relationshipCount = (long) result.iterator().next().get("relationshipCount");
+ assertThat(relationshipCount == 1);
+
+ session.clear();
+
+ Person mikeLoaded = session.load(Person.class, mike.getId(), 2);
+ session.save(mikeLoaded);
+
+ // Assert that the relationship is unidirectional from Dave -> Mike and not Dave <- Mike
+ cypherRelationshipCount = "match (n)<-[r:FRIEND_OF]-(m) return count(r) as relationshipCount";
+ result = session.query(cypherRelationshipCount, new HashMap());
+ relationshipCount = (long) result.iterator().next().get("relationshipCount");
+ assertThat(relationshipCount == 0); // NOTE: The behavior described by zoetsekas would result in a count of 1
+ cypherRelationshipCount = "match (n)-[r:FRIEND_OF]->(m) return count(r) as relationshipCount";
+ result = session.query(cypherRelationshipCount, new HashMap());
+ relationshipCount = (long) result.iterator().next().get("relationshipCount");
+ assertThat(relationshipCount == 1);
+
+ }
+
+}
diff --git a/issue-331/src/test/resources/logback-test.xml b/issue-331/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..9ca1833
--- /dev/null
+++ b/issue-331/src/test/resources/logback-test.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ %d %5p %40.40c:%4L - %m%n
+
+
+
+
+
+
+
+
+
+