jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tekbe <...@beaglesoft.de>
Subject Re: OCM: custom discriminator?
Date Mon, 25 May 2009 18:09:30 GMT

hello christophe,

from the user point of view an extension of the @Node-Interface would be
quite an improvement, e.g.

@Node(discriminator = true, discriminatorValue = "personBean")
public class PersonImpl {
...
}

This way, it would be possible to move the class to a different package and
rename it.

I think it's doable: The mapper knows all mapped classes and their
discriminator-values, so it can deliver the class for a given
discriminator-value (the mapper must assure each discriminator-value is
unique, that is, not two mapped classes share the same discriminator-value).
The discriminator-value could be stored with the data (like the classname is
stored now, e.g. using a node-property @ocm_discriminator).

However, I think, with this solution there are a still drawbacks compared to
well known orm-mapping tools:
 - the stored data is polluted with mapping-information.
 - it's not possible to mapp the same data differently with different
classes, e.g. two webapps sharing the same same data and loading it with
ocm.

But maybe I'm wrong. Is it possible to mapp nodes without any ocm-metadata
to objects?

best regards,
Tim


Christophe Lombart wrote:
> 
> 
>> is there a recommended way to use a custom (indirect) discriminator
>> instead
>> of the classname? Because maybe I want to change the classe's name or
>> move
>> it into another package. As far as I understand, this would break the
>> mapping, no?
> 
> yes, you are right, it is a real problem. So, it should be nice to find
> another way.
> 
>> I think it would be really nice, to simply define a custom
>> descriminator via the @Node-Annotation.
> 
> Can you provide more details ?  How to map the "indirect/custom"
> discriminator to a class ?
> 
> 

-- 
View this message in context: http://www.nabble.com/OCM%3A-custom-discriminator--tp23671580p23710938.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message