0

I am using Spring Data Neo4j 4.0.0.RC1 and am noticing some interesting behavior with GraphRepository's findOne method.

Given two GraphRepository extensions:

public interface SimpleNodeRepository extends GraphRepository<SimpleNode> {

}

public interface OtherNodeRepository extends GraphRepository<OtherNode> {

}

Then given a totally blank slate, say I create a single SimpleNode and it gets assigned an ID of 1L. When I call otherNodeRepository.findOne(1L), I get a ClassCastException instead of null. This suggests to me that the findOne method is getting the SimpleNode back and is not respecting the SDN node types.

Is this expected behavior? I think this can be worked around by creating a findById method in the respective repository interfaces but it seems to go against intuition and definitely seems inconsistent with say, how JPA repository handles it.

simonl
  • 1,240
  • 7
  • 19

1 Answers1

1

This isn't expected behaviour. https://jira.spring.io/browse/DATAGRAPH-707 to track this issue.

Please use the work around till fixed.

Luanne
  • 19,145
  • 1
  • 39
  • 51