You're right! I was pulling my hair out over this. I ended up having some old batch inserter code on my path that had a different implementation of PropertyRecord.
On Saturday, January 18, 2014 7:27:53 PM UTC-5, Michael Hunger wrote: > > Your code looks good, you probably have a version mismatch on your > classpath, make sure to have only Neo4j 2.0.0 final libs there. > > Michael > > Am 18.01.2014 um 16:13 schrieb Daniel Jue <[email protected] <javascript:> > >: > > Hi, I'm running Neo4J 2.0, stable. > > I've tried two ways of inserting a unique node through the java API (one > using unique node factory and a second version using cyper) on my embedded > neo4j instance. > > I'm running into an error on both attempts. I understand the Cyper MERGE > version is the new preferred way of doing it, so here is the stack trace > for the Cypher version (code included afterwards) > > Exception in thread "main" java.lang.NoSuchMethodError: > org.neo4j.kernel.impl.nioneo.store.PropertyRecord.clone()Lorg/neo4j/kernel/impl/nioneo/store/PropertyRecord; > at > org.neo4j.kernel.impl.nioneo.xa.WriteTransaction$2.clone(WriteTransaction.java:193) > at > org.neo4j.kernel.impl.nioneo.xa.WriteTransaction$2.clone(WriteTransaction.java:156) > at > org.neo4j.kernel.impl.nioneo.xa.RecordChanges$RecordChange.ensureHasBeforeRecordImage(RecordChanges.java:194) > at > org.neo4j.kernel.impl.nioneo.xa.RecordChanges$RecordChange.prepareForChange(RecordChanges.java:146) > at > org.neo4j.kernel.impl.nioneo.xa.RecordChanges$RecordChange.forChangingData(RecordChanges.java:141) > at > org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.addPropertyBlockToPrimitive(WriteTransaction.java:1667) > at > org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.addPropertyToPrimitive(WriteTransaction.java:1600) > at > org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1628) > at > org.neo4j.kernel.impl.persistence.PersistenceManager.nodeAddProperty(PersistenceManager.java:130) > at > org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeSetProperty(StateHandlingStatementOperations.java:521) > at > org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeSetProperty(ConstraintEnforcingEntityOperations.java:92) > at > org.neo4j.kernel.impl.api.LockingStatementOperations.nodeSetProperty(LockingStatementOperations.java:261) > at > org.neo4j.kernel.impl.api.OperationsFacade.nodeSetProperty(OperationsFacade.java:466) > at > org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$NodeOperations.setProperty(TransactionBoundExecutionContext.scala:150) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.DelegatingOperations.setProperty(DelegatingQueryContext.scala:96) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ > ExceptionTranslatingOperations.org > $neo4j$cypher$internal$compiler$v2_0$spi$ExceptionTranslatingQueryContext$ExceptionTr > > anslatingOperations$$super$setProperty(ExceptionTranslatingQueryContext.scala:121) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:121) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:121) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:121) > at org.neo4j.cypher.internal.compiler.v2_0. > spi.ExceptionTranslatingQueryContext.org > $neo4j$cypher$internal$compiler$v2_0$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQu > eryContext.scala:149) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.setProperty(ExceptionTranslatingQueryContext.scala:121) > at > org.neo4j.cypher.internal.compiler.v2_0.spi.UpdateCountingQueryContext$CountingOps.setProperty(UpdateCountingQueryContext.scala:129) > at > org.neo4j.cypher.internal.compiler.v2_0.mutation.PropertySetAction.exec(PropertySetAction.scala:44) > at > org.neo4j.cypher.internal.compiler.v2_0.mutation.MergeNodeAction$$anonfun$exec$1.apply(MergeNodeAction.scala:68) > at > org.neo4j.cypher.internal.compiler.v2_0.mutation.MergeNodeAction$$anonfun$exec$1.apply(MergeNodeAction.scala:68) > at scala.collection.immutable.List.foreach(List.scala:318) > at > org.neo4j.cypher.internal.compiler.v2_0.mutation.MergeNodeAction.exec(MergeNodeAction.scala:67) > at org.neo4j.cypher.internal.compiler.v2_0. > pipes.ExecuteUpdateCommandsPipe.org > $neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:56) > at > org.neo4j.cypher.internal.compiler.v2_0.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$2 > .apply(ExecuteUpdateCommandsPipe.scala:45) > at > org.neo4j.cypher.internal.compiler.v2_0.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$2 > .apply(ExecuteUpdateCommandsPipe.scala:45) > at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) > at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:38) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:37) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:37) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator.failIfThrows(ClosingIterator.scala:91) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator.hasNext(ClosingIterator.scala:37) > at scala.collection.Iterator$class.foreach(Iterator.scala:727) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator.foreach(ClosingIterator.scala:33) > at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48) > at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:176) > at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45) > at scala.collection.TraversableOnce$class.to(TraversableOnce.scala:273) > at org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator.to > (ClosingIterator.scala:33) > at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:257) > at > org.neo4j.cypher.internal.compiler.v2_0.ClosingIterator.toList(ClosingIterator.scala:33) > at > org.neo4j.cypher.internal.compiler.v2_0.EagerPipeExecutionResult.<init>(EagerPipeExecutionResult.scala:30) > at > org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anonfun$3.apply(ExecutionPlanBuilder.scala:137) > at > org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anonfun$3.apply(ExecutionPlanBuilder.scala:135) > at > org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anon$6.execute(ExecutionPlanBuilder.scala:50) > at > org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_0.execute(CypherCompiler.scala:93) > at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:61) > at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:65) > at > org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:78) > > > > My Cypher version of the unique insert looks like this: > > public Node getOrCreateUniqueNode(String indexName, String key, > Object value, final Map<String, Object> nodeProperties) { > if (ValidationUtils.isValid(indexName, key, value)) { > Node result = null; > ResourceIterator<Node> resultIterator = null; > try (Transaction tx = graphDb.beginTx()) { > String queryString = "MERGE (n:" + indexName + " {" + key > + ": {var}}) RETURN n"; > Map<String, Object> parameters = new HashMap<>(); > parameters.put("var", value); > resultIterator = executionEngine.execute(queryString, > parameters).columnAs("n"); > result = resultIterator.next(); > > tx.success(); > return result; > } catch (Exception e) { > e.printStackTrace(); > > } > } > return null; > } > > indexName is something like "USER" (provided from an enum that extends > Label, like MyEnum.USER.name() ) > key is something like "username" > and value is something like "Bob" > > Note that the nodeProperties parameter isn't getting used at this point, > I'm just trying to create the nodes. > > The exception starts at call resultIterator = > executionEngine.execute(queryString, parameters).columnAs("n"); > > The query string looks something like "MERGE (n:GLOBAL_ID {value: {var}}) > RETURN n" before the var gets substituted. > > Does it matter if the string var has characters like '/' at the beginning? > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
