You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by tekbe <te...@beaglesoft.de> on 2009/05/22 16:29:11 UTC

OCM: custom discriminator?

Hello,

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? I think it would be really nice, to simply define a custom
descriminator via the @Node-Annotation.

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


Re: OCM: custom discriminator?

Posted by tekbe <te...@beaglesoft.de>.
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.


Re: OCM: custom discriminator?

Posted by Christophe Lombart <ch...@gmail.com>.
2009/5/22 tekbe <te...@beaglesoft.de>

>
> Hello,
>
> 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 ?




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