Updated documentation to reflect relationship type precedence and new backwards-compatible transaction manager factory

This commit is contained in:
Lasse Westh-Nielsen
2012-06-21 16:58:51 +01:00
parent e36c771098
commit 7fdbbcbeb2
2 changed files with 42 additions and 25 deletions

View File

@@ -210,4 +210,39 @@ public class Friendship {
</example>
</section>
<section id="reference:programming_model:relationships:relationshiptypeprecedence">
<title>Relationship Type Precedence</title>
<para>In the example above we show how to specify a default relationship type, and how to provide the relationship
type using an annotation property. Here is an example of using the @RelationshipType annotation on a member
variable on the relationship entity; we call this dynamic relationship type.</para>
<example>
<title>Dynamic Relationship Type (simple mapping)</title>
<programlisting language="java"><![CDATA[
@RelationshipEntity(type = "colleague")
public class Acquaintance {
@StartNode private Actor actor;
@EndNode private Person acquaintance;
@RelationshipType private String connection;
public Acquaintance(Actor actor, Person acquaintance, String connection) {
...
Actor frankSinatra = ...
Person carloGambino = ...
new Acquaintance(frankSinatra, carloGambino, "its_complicated")
]]>
</programlisting>
</example>
<note>Because dynamic type information is, well, dynamic, it is generally not possible to read the mapping backwards
using SDN. The relationship still exists, but SDN cannot help you access it because it does not know what type you
gave it. Also, for this reason, we require you to specify a default relationship type, so that we can at least
attempt the reverse mapping.</note>
<para>Should you happen to provide conflicting relationship types, we have established the following precedence, in
priority order:</para>
<orderedlist>
<listitem>Dynamic</listitem>
<listitem>Annotation-provided</listitem>
<listitem>Default</listitem>
</orderedlist>
</section>
</section>

View File

@@ -32,18 +32,9 @@
</note>
<example>
<title>Simple transaction manager configuration</title>
<programlisting language="xml"><![CDATA[<bean id="neo4jTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<bean class="org.neo4j.kernel.impl.transaction.SpringTransactionManager">
<constructor-arg ref="graphDatabaseService"/>
</bean>
</property>
<property name="userTransaction">
<bean class="org.neo4j.kernel.impl.transaction.UserTransactionImpl">
<constructor-arg ref="graphDatabaseService"/>
</bean>
</property>
<programlisting language="xml"><![CDATA[<bean id="neo4jTransactionManager"
class="org.springframework.data.neo4j.config.JtaTransactionManagerFactoryBean">
<constructor-arg ref="graphDatabaseService"/>
</bean>
<tx:annotation-driven mode="aspectj" transaction-manager="neo4jTransactionManager"/>
@@ -57,7 +48,7 @@
</para>
<example>
<title>Neo4j Spring integration</title>
<programlisting language="xml"><![CDATA[<![CDATA[<context:annotation-config />
<programlisting language="xml"><![CDATA[<context:annotation-config />
<context:spring-configured/>
<bean id="transactionManager"
@@ -89,22 +80,13 @@
</para>
<example>
<title>ChainedTransactionManager example</title>
<programlisting language="xml"><![CDATA[<![CDATA[<bean id="jpaTransactionManager"
<programlisting language="xml"><![CDATA[<bean id="jpaTransactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="jtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<bean class="org.neo4j.kernel.impl.transaction.SpringTransactionManager">
<constructor-arg ref="graphDatabaseService" />
</bean>
</property>
<property name="userTransaction">
<bean class="org.neo4j.kernel.impl.transaction.UserTransactionImpl">
<constructor-arg ref="graphDatabaseService" />
</bean>
</property>
class="org.springframework.data.neo4j.config.JtaTransactionManagerFactoryBean">
<constructor-arg ref="graphDatabaseService"/>
</bean>
<bean id="transactionManager"
class="org.springframework.data.neo4j.transaction.ChainedTransactionManager">