1

I have two maven projects;

a) A REST Server project

b) A Rest consuming client project

I would like to make a 3rd project containing domain POJO classes - and add it as a dependency in the two other projects so I only have one project with the domain classes. However, the REST Server project is depended on org.neo4j.ogm which uses annotations to achieve graph persistence (@NodeEntity, @Id, @GeneratedValue, @RelationshipEntity etc.).

Clearly, I don't want the POJO project depended on anything, since it's going to be used by the client also. So my question is; can I add these settings manually somehow, not using the annotations?

Kasper
  • 133
  • 7

1 Answers1

1

Neo4j-OGM only works with annotations and does not have for example XML-based declaration support.

It would be a little bit hacky and limited but there is one scenario this could work:

  • Entities without @NodeEntity annotation will get recognized as such if you use an auto-generated id as Long id (without @Id and @GeneratedValue annotation).
  • No @RelationshipEntity definitions.
  • All relationships are outgoing and their names should get derived from their field name. (e.g. List<User> friends would become something like (...)-[:FRIENDS]->(:User))
  • No use of other Neo4j-OGM annotations like @Property, @Convert, etc.
meistermeier
  • 7,942
  • 2
  • 36
  • 45