incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Leau <>
Subject Re[2]: [jcr-mapping] PersistenceManager
Date Tue, 04 Oct 2005 09:38:58 GMT
Hello Christophe,

> On 10/4/05, Costin Leau <> wrote:
>> Hello,
>>  PersistenceManagerImplementation duplicates method from JCR session
>>  (item Exists and logout).
> How to check if an object exists ?
> There is 2 possibilities (IMPO) :
> * Check on the node path (/mypath/mynode)
> * Manage a unique id/object.
I'm not talking about how to check if an item exists but rather about
what this method does on the PersistenceManager interface. What value
does it adds - it's a duplicate of session, same signature but with a
different exception.
Why not remove the whole method ?; the code internally uses the session

From PersistenceManager one would expect a method like
exists(Object, String) - a method that check that an object is mapped
correctly inside the repository.

> Currently, the framework is using the first one. Is it necessary to
> use unique ID in a content repo context. I think the path is a good
> candidate to check if the object exist or not. Anyway, I'm agree to
> support both and/or see other alternatives.

The check is made for the existence of an item not an object; there is no
mapping just code duplicate.

>>Moreover this class which handles
>>  persistence and should be Repository bound is actually session-bound
>>  (one per session).
>>  Shouldn't the manager be one per Repository instead of one per
>>  session?

> Maybe the interface name is not correct (PersistenceManager) but this
> class is bound to a session. How to retrieve, update, delete object
> (and its underlaying nodes/prop) without a session object ? Logout
> method seems to be also important if it is bound to a JCR session.
The manager can get sessions from the repository using the login()
method. Right now the interface handles not only the persistence but
also session management. One one hand it requies a session to be given
but it can logout/close the session - what's the use, again?
It's just another method exactly replicated from the session with a
different signature. How does it help the mapping?

>>  Moreover I've seen there is no method for deleting an object but
>>  rather for removing a node which forces the developer to handle the mapping
>>  of the object in the JCR; there is no conversion being done at
>>  deleting time.

> Same as exist : either we delete a object with a path or an ID.

The actual implementation as I see removes the whole tree - there is
no mapping. I should give an object for removal AND a path, not just a
path - I want the mapping of the object to be removed not the whole
tree otherwise I would do that manually on the session.

Best regards,

View raw message