OGM RelationshipEntity between nodes of same label

Weird question, but I can't find any related docs. In most cases, whenever I'm mapping through @Relationship entities, the source and target nodes have differing labels / model classes. Now I have a case where I need to map sources and targets of the same label / model class. This appears to trip up the OGM, and it doesn't know which of the returned nodes should be the source and which the target, even though the relationship is clearly indicated (and returned by the query).

Does this sound like an unsupported mapping, or more like I'm doing it wrong? Code example:

@NodeEntity
data class Thing(@Id @GeneratedValue(strategy = UuidStrategy::class) var uuid: String? = null,
                                   @Relationship(type = "AUGMENTS", direction = Relationship.OUTGOING
                                   var augments: List<ThingAugments>? = null) { ... }

@RelationshipEntity(type = "AUGMENTS")
data class ThingAugments(@Id @GeneratedValue var id: Long? = null,
                                   @Property(name = "order") var order: Long? = null,
                                   @StartNode var source: Thing? = null,
                                   @EndNode var target: Thing? = null)

Nevermind – this was an issue with my (overly complicated) cypher query.

Oops. Fixing the cypher corrected the mapping problem. And while it now maps the (t1:Thing)-[:AUGMENTS]->(t2:Thing) properly, it also spills all the t2's to the top level, returning an array of Things. This will break e.g. calls that return a single object versus a list, and generally adds noise.

But it makes sense – I guess OGM must return all objects matching return type. I have no idea how to address this one, though. And sorry – this is specifically via SDN, using custom @Query on Repository calls.

I assume that it is related to this GitHub issue Projections (a.k.a Pattern comprehension) result in wrong query results · Issue #496 · neo4j/neo4j-ogm · GitHub that was solved with this commit: GH-496 - Improve mapping of results containing generated nodes. · neo4j/neo4j-ogm@3532cc0 · GitHub
You may test it by using the latest Spring Data Neo4j Moore Milestone (M1) and set the Neo4j-OGM version to 3.2.0-alpha04.

Perhaps, but for me it happens whether or not I'm using a pattern comprehension. But, if I do send the same @Query as would have been sent (or at least, logged) from e.g. FindBy* (which uses comprehensions), it exhibits the issue. Yet works for FindBy* – (?)

@gerrit.meier Thank you for the advice. Unfortunately, I am unable to get this combination of releases working in my project:

Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: org.neo4j.ogm.config.Configuration.mergeBasePackagesWith([Ljava/lang/String;)[Ljava/lang/String;

Sorry to raise the dead here, but I find I still have strange mapping reports, all the while mapping is working perfectly. I get a lot of this, is it normal?

ERROR 3537 --- [ctor-http-nio-4] org.neo4j.ogm.context.GraphEntityMapper  : Found more than one matching @RelationshipEntity for (9596)-[PRESENTS]->(9610) but cannot tell which one to use

This relates to my original post because it has to do with the same root issue: either I fundamentally misunderstand how the mapper works, or the mapper has a fundamental weakness in regards to directionality.