Padraic I. Hannon wrote:
A path is pretty fundamental to jcr, not having one would be like not
having a primary key for a bean retrieved from an orm solution. As most
orm's require beans to specify a pk I do not see the problem with ocm
doing the same. Trying to work around this I think would lead the ocm to
making all sorts of assumptions including all objects are created via
the ocm when there are times when working (esp. it would seem with
client/server stuff) that the object may not have been originally
retrieved via the ocm (I'm thinking value object patterns).
Yes, I more or less agree, but :) I can use ORM without mapping the PK,
for example in just reading use cases or I can even add new objects to
the database if the PK is auto generated. Updating and removing are the
things that do not work, but that's fine for me :)
In addition I'm not sure if the analogy to a database really fits, in
JCR the path is "some kind of pk", but depending on your content model
and your use cases, the path of an object can change (while a pk in a
database never changes). Definitly a uuid would be the ultimate pk, but
obviously you don't want to force to have a uuid for each and every node.
So as a first step I propose to change the implementation of the OCM to
allow the reading use case even if the path field is not mapped (to be
honest I haven't checked if this is not working right now, perhaps it
already works, so we don't have to change it).
Second step would be to introduce an insert(String path, Object) method
to add an object at the given path.
In general, and I just talked with Felix about this offline, it would be
interesting/nice to have an interface that does not rely on a path
(string) as the input for methods, but on a Node. In many use cases I
already have the Node where I want to query or insert objects. So this
could simplify the handling.
Perhaps it would also be worth to split or minimize the current OCM
interface as things like versioning are not required for most use cases.
WDYT?
Carsten
--
Carsten Ziegeler
[EMAIL PROTECTED]