Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency found between the bolt and http drivers in Neo4j 3.0.3 #195

Closed
jqp5000 opened this issue Jul 15, 2016 · 3 comments
Closed

Comments

@jqp5000
Copy link

jqp5000 commented Jul 15, 2016

From @jqp5000 on July 14, 2016 15:19

While coding a poc with Spring Neo4j using spring boot I came across what it seems to be an inconsistent behavior between the Bolt driver and the Http driver. Basically after saving a rich relationship between 2 nodes the test fails to load it when using the Bolt driver, however the exact same test succeeds when trying with the Http driver.

The sample project can be downloaded from github

It's a very basic/straight forward test, the only pre-requisite is that you will need to have Neo4j 3 installed with the Bolt connector enabled with authentication disabled. The tests consist in running the exact same code each time with a different driver.

When running 'mvn clean install' 2/3 tests will fail:

my.neo4j.poc.test.unit.BoltDriverTest will FAIL
my.neo4j.poc.test.unit.EmbeddedDriverTest will FAIL
my.neo4j.poc.test.unit.HttpDriverTest will SUCCEED

Neo4j Version: 3.0.3 (neo4j-ogm 2.0.3)
Operating System: Windows 10
API: Java API (Spring)

Steps to reproduce

  1. Run the BoltDriverTest, EmbeddedDriverTest, and the HttpDriverTest.

Expected behavior

All 3 tests should succeed.

Actual behavior

Only the Http test succeeds, the Embbeded and the Bolt test fail.

Copied from original issue: neo4j/neo4j#7581

@jqp5000
Copy link
Author

jqp5000 commented Jul 15, 2016

From @luanne on July 15, 2016 0:19

@jqp5000 thanks for reporting this, could you please report OGM issues here https://github.com/neo4j/neo4j-ogm/issues?

@luanne
Copy link
Contributor

luanne commented Jul 18, 2016

@jqp5000 the reason the relationship entity cannot be mapped is because the start and end node are unavailable with this query:

 @Query("MATCH (a:BankAccount)-[r:HAS_CONTACT]->(p:Person) " +
            "WHERE ID(a)={accountId} " +
            "RETURN r,")
    Iterable<Contact> findByAccountId(@Param("accountId") Long accountId);

You need to return these nodes to be able to construct a valid relationship entity, like this:

 @Query("MATCH (a:BankAccount)-[r:HAS_CONTACT]->(p:Person) " +
            "WHERE ID(a)={accountId} " +
            "RETURN r,a,p")
    Iterable<Contact> findByAccountId(@Param("accountId") Long accountId);

It's a side effect of the HTTP endpoint that allows this to pass- the start and end node are returned by this endpoint anyway.
Please see http://graphaware.com/neo4j/2016/04/06/mapping-query-entities-sdn.html for more info.

@luanne luanne closed this as completed Jul 18, 2016
@jqp5000
Copy link
Author

jqp5000 commented Jul 20, 2016

Thank you Luanne! it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants