Ogm.model Result automatically casts to Entity

Hi. I have a situation where a Person node relates to many other property nodes (rather than adding redundant properties directly to Person, e.g. CostCenter, Grade, Status, Role, etc.). All those node types have a name and uuid property, and I've written a service where the user can pass a uuid and look up one of those property nodes. I'm using a proc called apoc.search.node which allows a lookup by uuid across multiple node types, and I can glean the node type from the Result Label property, and the node name from the Result PropertyList. So far, so good. The problem is, if I have an entity of one of those node types in the entity scan path, ogm automatically converts the Result object (Iterable Map) to that entity object, requiring me to do an instanceof check on the result for that entity, which, in this case, is tedious and unnecessary. So my question is...does anyone know of a way to prevent that automatic casting of Result to an entity object? Or is it required that I create entity nodes and an explicit check for every possible type, or pass a node type with uuid and do explicit lookups by node rather than the apoc.search, either of which would require a lot of extra coding and maintenance for entity types that I only use here. My solution works nicely except for that piece. Any suggestions would be appreciated. Thanks, Bob

1 Like

Might help to know your context, environment, and frameworks a bit better. Without that, I'm wondering why you want to prevent OGM conversion – why use it at all? If your node labels and properties match those of a @NodeEntity class, then you'll get instances of that class back. If you don't want that, either drop OGM, or change either your labels or your class names, etc.

Thank you for the reply. The context is to resolve persons belonging to a group, the group config being a selection of 1 to n of those property nodes. Environment and framework are spring-boot, and basic dao/service/rest. I don't want to rename labels or classes, some of them have more than one usage and the entities are more appropriate in those cases. So...what might be a java alternative to OGM that would facilitate the call to an apoc procedure?