tidying up warnings
This commit is contained in:
@@ -40,7 +40,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -84,7 +83,7 @@ public class IndexTest extends EntityTestBase {
|
||||
//@Transactional
|
||||
//@Ignore("remove property from index not workin")
|
||||
public void testRemovePropertyFromIndex() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
try {
|
||||
Group group = persist(new Group());
|
||||
group.setName(NAME_VALUE);
|
||||
@@ -101,7 +100,7 @@ public class IndexTest extends EntityTestBase {
|
||||
//@Transactional
|
||||
//@Ignore("remove property from index not workin")
|
||||
public void testRemoveNodeFromIndex() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
try {
|
||||
Group group = persist(new Group());
|
||||
group.setName(NAME_VALUE);
|
||||
@@ -358,7 +357,7 @@ public class IndexTest extends EntityTestBase {
|
||||
Transaction tx = null;
|
||||
final Person p;
|
||||
try {
|
||||
tx = neo4jTemplate.beginTx();
|
||||
tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
p = persistedPerson(NAME_VALUE2, 30);
|
||||
tx.success();
|
||||
} finally {
|
||||
@@ -366,7 +365,7 @@ public class IndexTest extends EntityTestBase {
|
||||
}
|
||||
Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE2));
|
||||
try {
|
||||
tx = neo4jTemplate.beginTx();
|
||||
tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
p.setName(NAME_VALUE);
|
||||
tx.success();
|
||||
} finally {
|
||||
@@ -374,7 +373,7 @@ public class IndexTest extends EntityTestBase {
|
||||
}
|
||||
Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE));
|
||||
try {
|
||||
tx = neo4jTemplate.beginTx();
|
||||
tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
p.setName(NAME_VALUE2);
|
||||
tx.success();
|
||||
} finally {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class NodeEntityTest extends EntityTestBase {
|
||||
// own transaction handling because of http://wiki.neo4j.org/content/Delete_Semantics
|
||||
@Test(expected = DataRetrievalFailureException.class)
|
||||
public void testDeleteEntityFromGDC() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
Person p = persistedPerson("Michael", 35);
|
||||
Person spouse = persistedPerson("Tina", 36);
|
||||
p.setSpouse(spouse);
|
||||
@@ -192,7 +192,7 @@ public class NodeEntityTest extends EntityTestBase {
|
||||
|
||||
@Test(expected = DataRetrievalFailureException.class)
|
||||
public void testDeleteEntity() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
Person p = persistedPerson("Michael", 35);
|
||||
Person spouse = persistedPerson("Tina", 36);
|
||||
p.setSpouse(spouse);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class NoopTypeRepresentationStrategyTest extends EntityTestBase {
|
||||
}
|
||||
|
||||
private Thing createThing() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
try {
|
||||
Node node = neo4jTemplate.createNode();
|
||||
thing = new Thing();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SubReferenceNodeTypeRepresentationStrategyTest extends EntityTestBa
|
||||
}
|
||||
|
||||
private void createThing() {
|
||||
Transaction tx = neo4jTemplate.beginTx();
|
||||
Transaction tx = neo4jTemplate.getGraphDatabase().beginTx();
|
||||
try {
|
||||
thingNode = neo4jTemplate.createNode();
|
||||
thing = neo4jTemplate.setPersistentState(new Thing(),thingNode);
|
||||
|
||||
@@ -67,11 +67,13 @@ public class ConfigurationCheck implements ApplicationListener<ContextStartedEve
|
||||
private void checkNeo4jTransactionManager() {
|
||||
Transaction tx = null;
|
||||
try {
|
||||
tx = template.beginTx();
|
||||
tx = template.getGraphDatabase().beginTx();
|
||||
updateStartTime();
|
||||
tx.success();
|
||||
} catch (Exception e) {
|
||||
tx.failure();
|
||||
if (tx != null) {
|
||||
tx.failure();
|
||||
}
|
||||
throw new BeanCreationException("transactionManager not correctly configured, please refer to the manual, setup section",e);
|
||||
} finally {
|
||||
try {
|
||||
|
||||
@@ -19,8 +19,9 @@ package org.springframework.data.neo4j.core;
|
||||
import org.springframework.dao.UncategorizedDataAccessException;
|
||||
|
||||
public class UncategorizedGraphStoreException extends UncategorizedDataAccessException {
|
||||
private static final long serialVersionUID = 347947370839580927L;
|
||||
|
||||
public UncategorizedGraphStoreException(String msg, Throwable cause) {
|
||||
public UncategorizedGraphStoreException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
final TypeInformation<?> typeInformation = type.getTypeInformation();
|
||||
final FieldAccessorFactoryProviders<T> fieldAccessorFactoryProviders = accessorFactoryProviderCache.get(typeInformation);
|
||||
if (fieldAccessorFactoryProviders != null) return fieldAccessorFactoryProviders;
|
||||
final FieldAccessorFactoryProviders<T> newFieldAccessorFactories = new FieldAccessorFactoryProviders<T>(typeInformation, template);
|
||||
final FieldAccessorFactoryProviders<T> newFieldAccessorFactories = new FieldAccessorFactoryProviders<T>();
|
||||
type.doWithProperties(new PropertyHandler<Neo4jPersistentProperty>() {
|
||||
@Override
|
||||
public void doWithPersistentProperty(Neo4jPersistentProperty property) {
|
||||
|
||||
@@ -161,13 +161,6 @@ public class DetachedEntityState<STATE> implements EntityState<STATE> {
|
||||
public Object getDefaultValue(Neo4jPersistentProperty property) {
|
||||
return delegate.getDefaultValue(property);
|
||||
}
|
||||
private Object getDefaultValue(final Class<?> type) {
|
||||
if (type.isPrimitive()) {
|
||||
if (type.equals(boolean.class)) return false;
|
||||
return 0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
@@ -254,14 +247,6 @@ public class DetachedEntityState<STATE> implements EntityState<STATE> {
|
||||
return this.dirty.containsKey(property);
|
||||
}
|
||||
|
||||
private void clearDirty() {
|
||||
this.dirty.clear();
|
||||
}
|
||||
|
||||
private void clearDirty(final Field f) {
|
||||
this.dirty.remove(f);
|
||||
}
|
||||
|
||||
private void addDirty(final Neo4jPersistentProperty property, final Object previousValue, boolean fromGraph) {
|
||||
this.dirty.put(property, new ExistingValue(previousValue,fromGraph));
|
||||
}
|
||||
@@ -275,7 +260,7 @@ public class DetachedEntityState<STATE> implements EntityState<STATE> {
|
||||
@Override
|
||||
public Object persist() {
|
||||
if (!isDetached()) return getEntity();
|
||||
Transaction tx = template.beginTx();
|
||||
Transaction tx = template.getGraphDatabase().beginTx();
|
||||
try {
|
||||
Object result = delegate.persist();
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.springframework.data.neo4j.fieldaccess;
|
||||
|
||||
import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty;
|
||||
import org.springframework.data.neo4j.support.Neo4jTemplate;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -63,15 +61,10 @@ public class FieldAccessorFactoryProviders<T> {
|
||||
}
|
||||
}
|
||||
|
||||
private final TypeInformation<?> type;
|
||||
private final List<FieldAccessorFactoryProvider<T>> fieldAccessorFactoryProviders = new ArrayList<FieldAccessorFactoryProvider<T>>();
|
||||
private final IdFieldAccessorFactory idFieldAccessorFactory;
|
||||
private Neo4jPersistentProperty idProperty;
|
||||
|
||||
FieldAccessorFactoryProviders(TypeInformation<?> type, Neo4jTemplate template) {
|
||||
this.type = type;
|
||||
idFieldAccessorFactory= new IdFieldAccessorFactory(template);
|
||||
}
|
||||
FieldAccessorFactoryProviders() {}
|
||||
|
||||
public Map<Neo4jPersistentProperty, FieldAccessor> getFieldAccessors() {
|
||||
int count = fieldAccessorFactoryProviders.size();
|
||||
@@ -89,7 +82,7 @@ public class FieldAccessorFactoryProviders<T> {
|
||||
final Map<Neo4jPersistentProperty, List<FieldAccessListener>> result = new HashMap<Neo4jPersistentProperty, List<FieldAccessListener>>(count,1);
|
||||
for (int i = 0; i < count; i++) {
|
||||
FieldAccessorFactoryProvider<T> fieldAccessorFactoryProvider = fieldAccessorFactoryProviders.get(i);
|
||||
final List<FieldAccessListener> listeners = (List<FieldAccessListener>) fieldAccessorFactoryProvider.listeners();
|
||||
final List<FieldAccessListener> listeners = fieldAccessorFactoryProvider.listeners();
|
||||
result.put(fieldAccessorFactoryProvider.getProperty(), listeners);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -104,7 +104,8 @@ public class RelatedToViaCollectionFieldAccessorFactory implements FieldAccessor
|
||||
if (!(newVal instanceof Set)) {
|
||||
throw new IllegalArgumentException("New value must be at least an Iterable, was: " + newVal.getClass());
|
||||
}
|
||||
return relationshipEntities.loadEndNodeToRelationshipEntityMapping(startNode, (Iterable<Object>) newVal, relatedType);
|
||||
@SuppressWarnings("unchecked") Iterable<Object> iterable = (Iterable<Object>) newVal;
|
||||
return relationshipEntities.loadEndNodeToRelationshipEntityMapping(startNode, iterable, relatedType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class RelationshipHelper {
|
||||
|
||||
protected void removeMissingRelationshipsInStoreAndKeepOnlyNewRelationShipsInSet( Node node,
|
||||
Set<Node> targetNodes,
|
||||
Class targetType ) {
|
||||
Class<?> targetType ) {
|
||||
for ( Relationship relationship : node.getRelationships( type, direction ) ) {
|
||||
if ( !targetNodes.remove( relationship.getOtherNode( node ) ) ) {
|
||||
if ( targetType != null ) {
|
||||
|
||||
@@ -70,14 +70,15 @@ class ValidatingNodePropertyFieldAccessorListenerFactory implements FieldAccesso
|
||||
|
||||
public ValidatingNodePropertyFieldAccessorListener(final Neo4jPersistentProperty field, Validator validator) {
|
||||
this.propertyName = field.getName();
|
||||
this.entityType = (Neo4jPersistentEntity<?>) field.getOwner();
|
||||
this.entityType = field.getOwner();
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueChanged(Object entity, Object oldVal, Object newVal) {
|
||||
if (validator==null) return;
|
||||
Set<ConstraintViolation<T>> constraintViolations = validator.validateValue((Class<T>)entityType.getType(), propertyName, newVal);
|
||||
@SuppressWarnings("unchecked") Class<T> type = (Class<T>) entityType.getType();
|
||||
Set<ConstraintViolation<T>> constraintViolations = validator.validateValue(type, propertyName, newVal);
|
||||
if (!constraintViolations.isEmpty()) throw new ValidationException("Error validating field "+propertyName+ " of "+entityType+": "+constraintViolations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.springframework.data.mapping.model.MappingException;
|
||||
* @since 21.10.11
|
||||
*/
|
||||
public class InvalidEntityTypeException extends MappingException {
|
||||
private static final long serialVersionUID = -162835100413817687L;
|
||||
|
||||
public InvalidEntityTypeException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractGraphRepository<S extends PropertyContainer, T> im
|
||||
for (U entity : entities) {
|
||||
save(entity);
|
||||
}
|
||||
return (Iterable<U>) entities;
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.neo4j.graphdb.index.IndexManager;
|
||||
import org.neo4j.graphdb.index.UniqueFactory;
|
||||
import org.neo4j.graphdb.traversal.TraversalDescription;
|
||||
import org.neo4j.index.lucene.ValueContext;
|
||||
import org.neo4j.kernel.AbstractGraphDatabase;
|
||||
import org.neo4j.kernel.GraphDatabaseAPI;
|
||||
import org.neo4j.kernel.Traversal;
|
||||
import org.neo4j.kernel.impl.transaction.SpringTransactionManager;
|
||||
|
||||
@@ -267,14 +267,6 @@ public class Neo4jTemplate implements Neo4jOperations {
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegates to {@link GraphDatabase}
|
||||
*/
|
||||
@Deprecated
|
||||
public Transaction beginTx() { // TODO remove !
|
||||
return infrastructure.getGraphDatabase().beginTx();
|
||||
}
|
||||
|
||||
public boolean isNodeEntity(Class<?> targetType) {
|
||||
return getMappingContext().isNodeEntity(targetType);
|
||||
}
|
||||
@@ -289,8 +281,8 @@ public class Neo4jTemplate implements Neo4jOperations {
|
||||
return save( entity, null );
|
||||
}
|
||||
|
||||
public <T> T save( T entity, RelationshipType annotationProvidedRelationshipType )
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T save( T entity, RelationshipType annotationProvidedRelationshipType ) {
|
||||
return (T) infrastructure.getEntityPersister().persist(entity, getMappingPolicy(entity), this, annotationProvidedRelationshipType );
|
||||
}
|
||||
|
||||
@@ -317,6 +309,7 @@ public class Neo4jTemplate implements Neo4jOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> R getRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType) {
|
||||
notNull(start,"start",end,"end",relationshipEntityClass,"relationshipEntityClass",relationshipType,"relationshipType");
|
||||
final Relationship relationship = infrastructure.getEntityStateHandler().getRelationshipBetween(start, end, relationshipType);
|
||||
@@ -327,6 +320,7 @@ public class Neo4jTemplate implements Neo4jOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Iterable<R> getRelationshipsBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType) {
|
||||
notNull(start,"start",end,"end",relationshipEntityClass,"relationshipEntityClass",relationshipType,"relationshipType");
|
||||
final Iterable<Relationship> relationships = infrastructure.getEntityStateHandler().getRelationshipsBetween(start, end, relationshipType);
|
||||
@@ -495,6 +489,7 @@ public class Neo4jTemplate implements Neo4jOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ResultConverter getDefaultConverter() {
|
||||
final ResultConverter resultConverter = infrastructure.getResultConverter();
|
||||
if (resultConverter instanceof Neo4jTemplateAware) {
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.data.neo4j.support.conversion;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
|
||||
public class NoSuchColumnFoundException extends MappingException {
|
||||
private static final long serialVersionUID = 3426743116009442464L;
|
||||
|
||||
public NoSuchColumnFoundException( String column ) {
|
||||
super( "Expexted a column named "+ column + " to be in the result set." );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.dao.DataRetrievalFailureException;
|
||||
* @since 16.10.11
|
||||
*/
|
||||
public class NoSuchIndexException extends DataRetrievalFailureException {
|
||||
private static final long serialVersionUID = -5708027180371353224L;
|
||||
|
||||
private final String index;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.neo4j.support.mapping;
|
||||
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.mapping.event.MappingContextEvent;
|
||||
@@ -40,9 +41,9 @@ public class IndexCreationMappingEventListener implements ApplicationListener<Ma
|
||||
ensureEntityIndexes(entity);
|
||||
}
|
||||
|
||||
private void ensureEntityIndexes(Neo4jPersistentEntity entity) {
|
||||
private void ensureEntityIndexes(Neo4jPersistentEntity<?> entity) {
|
||||
final Class entityType = entity.getType();
|
||||
template.getIndex(entityType, null, IndexType.SIMPLE);
|
||||
@SuppressWarnings("unchecked") Index index = template.getIndex(entityType, null, IndexType.SIMPLE);
|
||||
entity.doWithProperties(new PropertyHandler<Neo4jPersistentProperty>() {
|
||||
@Override
|
||||
public void doWithPersistentProperty(Neo4jPersistentProperty property) {
|
||||
|
||||
@@ -335,6 +335,7 @@ class Neo4jPersistentPropertyImpl extends AbstractPersistentProperty<Neo4jPersis
|
||||
/**
|
||||
* @deprecated todo remove when SD-Commons handles transient properties differently
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isReallyTransient() {
|
||||
return Modifier.isTransient(field.getModifiers()) || isAnnotationPresent(Transient.class) || isAnnotationPresent("javax.persistence.Transient");
|
||||
}
|
||||
|
||||
@@ -69,10 +69,6 @@ public class SourceStateTransmitter<S extends PropertyContainer> {
|
||||
entityState.setValue(property, value, mappingPolicy);
|
||||
}
|
||||
|
||||
private <T> T getProperty(BeanWrapper<Neo4jPersistentEntity<Object>, Object> wrapper, Neo4jPersistentProperty property, Class<T> type, boolean fieldAccessOnly) {
|
||||
return wrapper.getProperty(property, type, fieldAccessOnly);
|
||||
}
|
||||
|
||||
private <R> Object getProperty(BeanWrapper<Neo4jPersistentEntity<R>, R> wrapper, Neo4jPersistentProperty property) {
|
||||
try {
|
||||
return wrapper.getProperty(property);
|
||||
@@ -100,7 +96,7 @@ public class SourceStateTransmitter<S extends PropertyContainer> {
|
||||
}
|
||||
|
||||
public <R> void copyPropertiesTo(final BeanWrapper<Neo4jPersistentEntity<R>, R> wrapper, S target, Neo4jPersistentEntity<R> persistentEntity, MappingPolicy mappingPolicy, final Neo4jTemplate template) {
|
||||
final Transaction tx = template.beginTx();
|
||||
final Transaction tx = template.getGraphDatabase().beginTx();
|
||||
try {
|
||||
final EntityState<S> entityState = entityStateFactory.getEntityState(wrapper.getBean(), false, template);
|
||||
entityState.setPersistentState(target);
|
||||
|
||||
@@ -52,6 +52,6 @@ public class CypherQueryExecutor implements QueryOperations<Map<String,Object>>
|
||||
}
|
||||
|
||||
public <T> T queryForObject(String statement, Class<T> type, Map<String,Object> params) {
|
||||
return (T) queryEngine.query(statement, params).to(type).single();
|
||||
return queryEngine.query(statement, params).to(type).single();
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ public abstract class StateProvider {
|
||||
private StateProvider() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <STATE> void setUnderlyingState(STATE state) {
|
||||
if (stateHolder.get() != null)
|
||||
throw new IllegalStateException("StateHolder already contains state " + stateHolder.get() + " in thread "
|
||||
@@ -37,7 +38,7 @@ public abstract class StateProvider {
|
||||
}
|
||||
|
||||
public static <STATE> STATE retrieveState() {
|
||||
STATE result = (STATE) stateHolder.get();
|
||||
@SuppressWarnings("unchecked") STATE result = (STATE) stateHolder.get();
|
||||
stateHolder.remove();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class Neo4jPersistentTestBase {
|
||||
conversionService = template.getConversionService();
|
||||
|
||||
|
||||
tx = template.beginTx();
|
||||
tx = template.getGraphDatabase().beginTx();
|
||||
group = new Group();
|
||||
michael = new Person("Michael", 37);
|
||||
emil = new Person("Emil", 30);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.data.neo4j.repository;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.neo4j.graphdb.NotFoundException;
|
||||
import org.neo4j.graphdb.Transaction;
|
||||
import org.neo4j.kernel.impl.util.FileUtils;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -42,7 +41,7 @@ public class ReadWriteTest {
|
||||
delete = true;
|
||||
assertEquals(Volvo.class, car.getClass());
|
||||
} else {
|
||||
Transaction tx = template.beginTx();
|
||||
Transaction tx = template.getGraphDatabase().beginTx();
|
||||
Volvo volvo = template.save(new Volvo());
|
||||
assertEquals(1, volvo.id.intValue());
|
||||
tx.success();
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.data.neo4j.support.Neo4jTemplate;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
@@ -84,7 +83,7 @@ public class Neo4jTemplateApiTest {
|
||||
@Test
|
||||
public void testBeginTxWithoutConfiguredTxManager() throws Exception {
|
||||
Neo4jTemplate template = new Neo4jTemplate(graphDatabase);
|
||||
Transaction tx = template.beginTx();
|
||||
Transaction tx = template.getGraphDatabase().beginTx();
|
||||
Node node = template.createNode();
|
||||
node.setProperty("name","foo");
|
||||
tx.success();
|
||||
@@ -95,7 +94,7 @@ public class Neo4jTemplateApiTest {
|
||||
@Test
|
||||
public void testInstantiateEntity() throws Exception {
|
||||
Neo4jTemplate template = new Neo4jTemplate(graphDatabase,transactionManager);
|
||||
Transaction tx = template.beginTx();
|
||||
Transaction tx = template.getGraphDatabase().beginTx();
|
||||
Person michael = template.save(new Person("Michael", 37));
|
||||
assertNotNull(michael.getId());
|
||||
}
|
||||
@@ -345,12 +344,6 @@ public class Neo4jTemplateApiTest {
|
||||
assertEquals("rel2",relationship.getProperty("name","not set"));
|
||||
}
|
||||
|
||||
private static class PathRelationshipNameMapper extends ResultConverter.ResultConverterAdapter<Path,String> {
|
||||
@Override
|
||||
public String convert(Path path, Class<String> type) {
|
||||
return (String) path.lastRelationship().getProperty("name","not set");
|
||||
}
|
||||
}
|
||||
private static class PathNodeNameMapper extends ResultConverter.ResultConverterAdapter<Path,String> {
|
||||
@Override
|
||||
public String convert(Path path, Class<String> type) {
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
|
||||
http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd">
|
||||
<context:annotation-config/>
|
||||
<neo4j:config graphDatabaseService="graphDatabaseService"/>
|
||||
<neo4j:repositories base-package="org.springframework.data.neo4j.repository"/>
|
||||
|
||||
Reference in New Issue
Block a user