Announcement Announcement Module
Collapse
No announcement yet.
[Neo4j] duplicate INSTANCE_OF using SubReferenceNodeTypeRepresentationStrategy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Neo4j] duplicate INSTANCE_OF using SubReferenceNodeTypeRepresentationStrategy

    I'm trying to configure SDN to use the SubReferenceNodeTypeRepresentationStrategy. When I save an @NodeEntity class the first time - things seem to work - I get the INSTANCE_OF relationship and "type node" created as expected. But the next time @NodeEntity is saved or updated - another INSTANCE_OF relationship is created to the "type node" - which results in the following exception:

    Code:
    java.util.NoSuchElementException: More than one element in org.neo4j.helpers.collection.IterableWrapper$MyIteratorWrapper@33264613. First element is 'http://localhost:7474/db/data/relationship/1' and the second element is 'http://localhost:7474/db/data/relationship/6'
    	at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:118)
    	at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:260)
    How can I configure SDN to create just one INSTANCE_OF relationship? Are there docs on configuring the SubReferenceNodeTypeRepresentationStrategy? I feel I hacked mine together. Below is my config. Thanks in advance. M

    Code:
        <neo4j:config graphDatabaseService="graphDatabaseService"/> 
        <bean id="typeRepresentationStrategyFactory"	
              class="org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
            <constructor-arg index="0" ref="graphDatabaseService"/>
            <constructor-arg index="1">
                <bean factory-method="valueOf"
                      class="org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.Strategy">
                    <constructor-arg>
                        <value>SubRef</value>
                    </constructor-arg>
                </bean>
            </constructor-arg>
        </bean>
Working...
X