You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Rimfrost74 <an...@gmail.com> on 2009/09/10 11:56:41 UTC

OCM calling setter method upon initialization

Hi,

We use OCM to store domain objects in our repository.

For one class, we have a field indicating a status for the object. This
status
has lots of business rules attached to it. This business logic is in the
setStatus method... So, the problem is, when populating the object from OCM,
the
set method is invoked, and the business rule is broken.
IS there a way to tell OCM what set method to use for a field, or set it via
reflection a là Spring?

Regards Anders
-- 
View this message in context: http://www.nabble.com/OCM-calling-setter-method-upon-initialization-tp25380433p25380433.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM calling setter method upon initialization

Posted by Rimfrost <an...@it-arkitekterna.se>.
Christophe, 
Thanks for your reply.
But I disagree with you about the design, I belevie that business rules
should definetily be coded in domain objects where this is possible. But
thats a totally different discussion ;)

Regards,
Anders


Christophe Lombart wrote:
> 
> Hi Anders,
> 
> No, it is not possible. IMHO this is not a good design to have
> business rules in Domain object.
> You should try to move the code into some business services.
> 
> br,
> Christophe
> 
> 2009/9/10 Rimfrost74 <an...@gmail.com>:
>>
>> Hi,
>>
>> We use OCM to store domain objects in our repository.
>>
>> For one class, we have a field indicating a status for the object. This
>> status
>> has lots of business rules attached to it. This business logic is in the
>> setStatus method... So, the problem is, when populating the object from
>> OCM,
>> the
>> set method is invoked, and the business rule is broken.
>> IS there a way to tell OCM what set method to use for a field, or set it
>> via
>> reflection a là Spring?
>>
>> Regards Anders
>> --
>> View this message in context:
>> http://www.nabble.com/OCM-calling-setter-method-upon-initialization-tp25380433p25380433.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/OCM-calling-setter-method-upon-initialization-tp25380433p25396061.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM calling setter method upon initialization

Posted by Christophe Lombart <ch...@gmail.com>.
Hi Anders,

No, it is not possible. IMHO this is not a good design to have
business rules in Domain object.
You should try to move the code into some business services.

br,
Christophe

2009/9/10 Rimfrost74 <an...@gmail.com>:
>
> Hi,
>
> We use OCM to store domain objects in our repository.
>
> For one class, we have a field indicating a status for the object. This
> status
> has lots of business rules attached to it. This business logic is in the
> setStatus method... So, the problem is, when populating the object from OCM,
> the
> set method is invoked, and the business rule is broken.
> IS there a way to tell OCM what set method to use for a field, or set it via
> reflection a là Spring?
>
> Regards Anders
> --
> View this message in context: http://www.nabble.com/OCM-calling-setter-method-upon-initialization-tp25380433p25380433.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>