andreasronge/neo4j — Issue #104: http://neo4j.lighthouseapp.com/projects/15548/tickets/178-batchimporter-does-not-alllow-symbol-for-keys-on-relationships
Author: dnagir
Created: 2011-12-14 23:18:28+00:00
State: open

Also, the database is in a corrupt state after the error.

Failure:

```
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #>, @batch_inserter=#>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, :since => '2009') # NOTE: using symbol :since
NativeException: java.lang.ClassCastException: org.jruby.RubySymbol cannot be cast to java.lang.String
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:419:in `createPropertyChain'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:198:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):6:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
jruby-1.6.3 :007 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009') # changed from using a symbol to using a string
NativeException: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[0] not in use
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:229:in `getRecord'
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:96:in `getRecord'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:210:in `connectRelationship'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:195:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):7:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
```

Success:

```
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #>, @batch_inserter=#>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009')
=> nil
jruby-1.6.3 :007 > inserter.shutdown
=> nil
```

http://neo4j.lighthouseapp.com/projects/15548/tickets/178-batchimporter-does-not-alllow-symbol-for-keys-on-relationships