Using OGM with @NodeEntity(label="...") on interface

(Tomzirn) #1

OGM (v3.1.1) doesn't seem to support @NodeEntity on an interface class with the label specified explicitly. Let's say, I have an annotated interface:

@NodeEntity(label = "MY_LABEL")
interface MyInterface { ... }

which is implemented by a class MyInterfaceImpl. Now, I can't make OGM map the entity names in the db result (MY_LABEL) to the corresponding java class (MyInterfaceImpl) - there seems to be no mapping "label => interface => implementing class". However, it does work as expected when the label is identical to the interface name.

Am I missing something?

(Jiropole) #3

Interesting. Have you tried putting the @NodeEntity annotation on the implementation class?

(Tomzirn) #4

Thanks, @Jiropole, I did some further research, and indeed:

  • Where interface name != node label, @NodeEntity(label="...") has to be set on the implementation class.
  • On the other hand, where interface name == node label, @NodeEntity (without label=...) needs to be on the interface, otherwise no mapping is found (see

Not quite self-explaining, I couldn't find any documentation about this, though.