>[...]
>      As it is known, Hibernate uses accessors (getters/setters) to
>      access object properties. This is noted as a RIGHT THING
>      in documentation, since it raises incapsulation. That's right,
>      but I have a few real-world examples that show that direct field
>      access can be (highly) desirable.

I would give much more examples. I've got samples of classes where almost
all methods are duplicated to have internal and external variants. Internal
methods are used to load state and external are used to access state.

For example i've got a lot of parent-child objects having property access
patterns like:

.. getXXX() {
if( xxx == null)
    return parent.getXXX();
else
   return xxx;
}

I can't use it with hibernate directly, cause all derived property values
would automatically migrate to childs in case that child is updated.

Personally I find more cases where it's better to have persistence mechanism
implemented assuming direct access to object's _internal_ state than those
where persistence should be actually firewalled with property accessors. I
would rather tend to say that I have absolutely no examples where property
accessors are helpful for persistence.  Maybe in case of accessing some
legacy data where we can't trust that those data are "compatible" with
object.

I would call this patch as one of The-Most-Wanteds.

-- Mike





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to