Attributes of inherit class are not present in stored procedure output with return type Stream<AbstractClass>


(Stefan Haunsberger) #1

Outline:

I have a stored procedure with the return type Stream<AbstractClass>.
Depending on a boolean parameter input value the return class is either ExtendedFromAbstractClass1 or ExtendedFromAbstractClass2.

Observation:

Only the attributes contained in the AbstractClass are present in the output but none of the ExtendedFromAbstractClass1 or ExtendedFromAbstractClass2 attributes.

Question:

Is there a way that extended class attributes are also contained in the output?

Setup:

  • Neo4j version 3.4.1
  • Neo4j Java Driver 1.6.2 (July 2018)

(Michael Hunger) #2

Unfortunately the current implementation of the procedures API doesn't look at inherited attributes.

So for now you'd have to copy those into the concrete classed. Sorry for that.


(Stefan Haunsberger) #3

This means that, currently, the only workaround is to implement two separate functions:

  • Stream<ExtendedFromAbstractClass1> first function
  • Stream<ExtendedFromAbstractClass2> second function

instead of being able to use the parameter?


(Michael Hunger) #4

You cannot have parameterized return types for the same procedure anyway.
It has to be a concrete class b/c the output fields are generated for that at load-time not runtime.