title: Why can't i create a neo4j relationship with spring data for neo?
body: <p>i'm fairly new to spring data for neo (though i have experience with neo4j itself). i tried following the 'official' guide on spring data for neo, specifically the chapter on <a href="http://docs.spring.io/autorepo/docs/spring-data-neo4j/current/reference/html/#creating_relationships" rel="nofollow">creating relationships</a>.</p>
  
  <p>But it seems i cannot get it to work. Spring is giving me an </p>
  
  <p><code>java.lang.IllegalStateException: This index (Index[__rel_types__,Relationship]) has been marked as deleted in this transaction</code></p>
  
  <p>Let me stress, that i am NOT removing any nodes or relationships. These are the relevant classes of my domain model:</p>
  
  <pre><code>@NodeEntity
  public class User {
  
      @GraphId
      private Long nodeid;
  
      @Indexed(unique = true)
      private String uuid;
      ....
  
  
  }
  
  @NodeEntity
  public class Website {
  
      @GraphId
      private Long nodeid;
  
      @Indexed(unique = true)
      private String uuid;
  
      ....
  
  }
  
  @RelationshipEntity(type = RelTypes.REL_USER_INTERESTED_IN)
  public class UserInterest {
  
      @GraphId
      private Long nodeid;
  
      @StartNode
      private User user;
  
      @EndNode
      private Website site;
      ...
  
  }
  </code></pre>
  
  <p>And this is my basic test which i can't get to turn green ..
  (note that i omitted large portions of the code, the basic setup of the spring context etc. is working fine)</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration
  @Transactional
  public class BaseTest {
  
      @Autowired
      protected Neo4jTemplate template;
      @Autowired
      protected GraphDatabaseService graphDatabaseService;
  
      protected Transaction tx;
  
      @Configuration
      @EnableNeo4jRepositories
      static class TestConfig extends Neo4jConfiguration {
          TestConfig() throws ClassNotFoundException {
              setBasePackage("me.bcfh.model");
          }
  
          @Bean
          GraphDatabaseService graphDatabaseService() {
              return new TestGraphDatabaseFactory().newImpermanentDatabase();
          }
  
      }
  
      public void before() {
          // provide implementation if necessary
      }
  
      public void after() {
          // provide implementation if necessary
  
      }
  
      @Before
      public void setup() throws Exception {
          Neo4jHelper.cleanDb(graphDatabaseService, false);
          before();
      }
  
      @After
      public void tearDown() throws Exception {
          after();
          if (tx != null) {
              tx.success();
              tx.close();
              tx = null;
          }
      }
  }
  public class BasicGraphTest extends BaseTest {
  
      User user;
      Website website;
      UserInterest interest;
  
      @Override
      public void before() {
          user = new User();
          website = new Website();
          website = template.save(website);
          user = template.save(user);
      }
  
      @Test
      @Transactional
      public void dbShouldContainData() throws Exception {
          UserInterest interest = new UserInterest();
          interest.setSite(website);
          interest.setUser(user);
          template.save(interest);
  
          // some assertions 
          ... 
      }
  }
  </code></pre>
  
  <p>The IllegalStateException is being thrown when I try persisting the UserInterest instance, which I do not understand because I am not removing anything anywhere. </p>
  
  <p>The ways to create a relationship mentioned in the spring guide did not work for me either, here I got the same exception .. </p>
  
  <p>Can anyone spot what I'm doing wrong here? </p>
  
  <p>I am using Spring Version 4.1.4.RELEASE and Spring Data For Neo Version 3.2.1.RELEASE. Neo4j has version 2.1.6 </p>
  
  <p>Note: I also tried copying the domain model classes from the <a href="https://github.com/spring-projects/spring-data-neo4j/tree/master/spring-data-neo4j-examples/cineasts" rel="nofollow">cineasts</a> example into my project and borrowed a few lines of the DomainTest class but this too gives me the IllegalStateException, maybe there is something wrong with my setup?</p>