fixed dependency management for aspect-based and cross-store peristence

This commit is contained in:
Michael Hunger
2011-10-10 12:24:53 +02:00
parent 4329846644
commit 09ab48ebfa
5 changed files with 8 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.jta.JtaTransactionManager;
import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;
/**
@@ -59,7 +60,7 @@ public class CrossStoreNeo4jConfiguration extends Neo4jAspectConfiguration {
@Bean
protected EntityInstantiator<Node> graphEntityInstantiator() {
if (isUsingCrossStorePersistence()) {
return new CrossStoreNodeEntityInstantiator(new NodeEntityInstantiator(entityStateHandler()), entityManagerFactory);
return new CrossStoreNodeEntityInstantiator(new NodeEntityInstantiator(entityStateHandler()), entityManagerFactory);
} else {
return new NodeEntityInstantiator(entityStateHandler());
}
@@ -82,9 +83,11 @@ public class CrossStoreNeo4jConfiguration extends Neo4jAspectConfiguration {
return new CrossStoreNodeEntityStateFactory();
}
@PostConstruct
@Override
public void wireEntityStateFactories() throws Exception {
super.wireEntityStateFactories();
nodeEntityStateFactory().setEntityManagerFactory(entityManagerFactory);
nodeEntityStateFactory().postConstruct();
}
}

View File

@@ -70,8 +70,7 @@ public class CrossStoreNodeEntityStateFactory extends NodeEntityStateFactory {
this.entityManagerFactory = entityManagerFactory;
}
@PostConstruct
private void setUp() {
public void postConstruct() {
this.delegatingFieldAccessorFactory = new CrossStoreNodeEntityState.CrossStoreNodeDelegatingFieldAccessorFactory(graphDatabaseContext);
}

View File

@@ -121,7 +121,7 @@
<bean id="nodeTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getNodeTypeRepresentationStrategy" />
<bean id="relationshipTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getRelationshipTypeRepresentationStrategy"/>
<bean id="nodeEntityStateFactory" class="org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityStateFactory">
<bean id="nodeEntityStateFactory" class="org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityStateFactory" init-method="postConstruct">
<property name="nodeDelegatingFieldAccessorFactory">
<bean class="org.springframework.data.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory">
<constructor-arg ref="graphDatabaseContext"/>

View File

@@ -51,11 +51,9 @@ public class PropertyFieldAccessorFactory implements FieldAccessorFactory {
protected final Neo4jPersistentProperty property;
protected final String propertyName;
protected final Class<?> fieldType;
private ConversionService conversionService;
public PropertyFieldAccessor(GraphDatabaseContext graphDatabaseContext, Neo4jPersistentProperty property) {
this.graphDatabaseContext = graphDatabaseContext;
conversionService = graphDatabaseContext.getConversionService();
this.property = property;
this.propertyName = property.getNeo4jPropertyName();
this.fieldType = property.getType() ;

View File

@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.Set;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.Direction;
import org.springframework.data.mapping.PropertyPath;
@@ -35,6 +36,7 @@ import org.springframework.data.neo4j.mapping.Neo4jMappingContext;
*
* @author Oliver Gierke
*/
@Ignore("until merged with DATAGRAPH-113")
public class MatchClauseUnitTest {
Neo4jMappingContext context;