The inheritance model as described here
http://forum.springsource.org/showthread.php?108657-Inheritance-in-spring-data-graph
is nice when one wants to do polymorphic queries, when the types
should be looked at together at once.
For example Person with Customer and Employee and a general search is desired.

However, when the types should be treated separately, and they just
happen to have a common superclass because
they share common functionality then I'd wish to have something like
JPA @MappedSuperclass.
As it is now, when I annotate my subtypes with @NodeEntity then the
attributes of the superclass are simply ignored.
There is no annotation to also include those fields in the Entity.

This means I'm left with the 2 choices:

1) The subtypes have the @NodeEntity annotation.
Move all fields down to the impls, which can cause a lot of
boilerplate code. Using a common parent class becomes
almost useless. Then, the Repository interfaces (those extending
GraphRepository) are created for each subtype, and
the types are queried separately.

2) The supertype has the @NodeEntity annotation.
Keep the common fields in the superclass. If there is an @Indexed
String then it can be queried only through the
parent class (the Repository for the parent class). If one wants to
only find certain subtypes then he has to loop through
the result and filter. With millions of objects, as is the case for
me, this is the higher cost.

So my wish is to have the @MappedSuperclass feature. And it would be
nice if such facts were documented so
that not everyone has to ask or figure out himself by trial and error.
My assumptions caused me to change code back
and forth a couple of times. It seems to me that the developers are
spending a lot of their time answering questions.

best,
gonfi
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to