Re: [Neo4j] POJO best practice?

2011-02-14 Thread Rick Bullotta
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: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] 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
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] POJO best practice?

2011-02-14 Thread David Montag
Hi Massimo,

You can also check out our integration with Spring Data:
http://www.springsource.org/spring-data  If you scroll down you can find
links to the docs and the github repo.

This approach uses a simple POJO model with annotations, like JPA. It
minimizes boilerplate code, and gives you a lot of stuff for free. There is
also rudimentary cross-store support, for building applications that span
across both a JPA datasource and Neo4j. Please let us know if you have any
questions.

David

On Mon, Feb 14, 2011 at 6:56 AM, Massimo Lusetti mluse...@gmail.com wrote:

 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
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
David Montag
Neo Technology, www.neotechnology.com
Cell: 650.556.4411
david.mon...@neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user