FYI, we don't follow that pattern on our application. In our domain model, we use a base class that includes the node getter/setter and some other common properties/services, and all domain objects extend that class. Separately, we have a persistence layer that manages persistence of POJO/domain objects into and out of Neo (as well as into and out of XML and JSON). We have also chosen to implement the persistence layer in a multi-pass design, due to the dependencies that can occur when multiple objects need to be persisted, but there are relationships between them (and therefore they all must have been initially persisted prior to defining relationships between them). A similar process occurs when a domain object is deleted (de-persisted) - a two-pass process of deleting relationships and then the node itself.
We have found that there are many challenges in assuming "atomic persistence" (e.g. a single call can persist an object) in an environment where relationships exist between entities, and have had to do quite a bit of work to ensure that everything gets saved in the correct order when multiple domain objects are created/updated. Rick -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Massimo Lusetti Sent: Monday, February 14, 2011 9:56 AM To: Neo4j user discussions Subject: [Neo4j] POJO best practice? Hi all, In almost all applications/examples/doc/wiki I've seen on neo4j.org the domain is based on POJO and this is somewhat usual but here I see you suggesting doing interface for POJO. Having an Actor interface implemented by an ActorImpl classes which is a POJO plus a reference to the "underlying node". First why having an interface declaring a POJO just for getters/setters method, isn't this boilerplate code? Second since you do that, why not exposing the "underlying node" as a getter so you can just use Actor and never had to cast it to ActorImpl? Am I missing something? Cheers -- Massimo http://meridio.blogspot.com _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

