[hibernate-dev] HHH-11155 : problems updating lazy properties in lazy groups

Steve Ebersole steve at hibernate.org
Wed Nov 2 09:49:13 EDT 2016


It looks like I only adjusted the reading of values (SELECT) for
fetch-groups.

Updates should only consider initialized attributes.  I had assumed that
was already the case.

The same is probably true for property-based optimistic locking as well.
We should verify that feature as well


On Wed, Oct 26, 2016 at 2:15 AM Gail Badner <gbadner at redhat.com> wrote:

> Static update strings appear to cover only the following situations:
> 1) there are no uninitialized properties (so all updateable attributes
> should be updated);
> 2) all lazy properties are uninitialized (so only
> non-lazy, updateable attributes should be updated).
>
> As of 5.1, we have "lazy groups". It is possible some lazy groups are
> initialized, and some are uninitialized. We have a couple of alternatives
> for dealing with the various combinations:
>
> For example, if there are are 3 lazy groups: lazyGroup1, lazyGroup2,
> lazyGroup3.
>
> 1) Generate SQL update strings for all possible combinations of initialized
> lazy groups:
>
> SQL update strings are already generated for the following combinations:
>
> * lazyGroup1: uninitialized;  lazyGroup2: uninitialized; lazyGroup3:
> uninitialized
> * lazyGroup1: initialized;  lazyGroup2: initialized; lazyGroup3:
> initialized
>
> SQL update strings for the following combinations need to be generated to
> fix the bug:
>
> * lazyGroup1: initialized;  lazyGroup2: uninitialized; lazyGroup3:
> uninitialized
> * lazyGroup1: uninitialized;  lazyGroup2: initialized; lazyGroup3:
> uninitialized
> * lazyGroup1: uninitialized;  lazyGroup2: uninitialized; lazyGroup3:
> initialized
> * lazyGroup1: initialized;  lazyGroup2: initialized; lazyGroup3:
> uninitialized
> * lazyGroup1: initialized;  lazyGroup2: uninitialized; lazyGroup3:
> initialized
> * lazyGroup1: uninitialized;  lazyGroup2: initialized; lazyGroup3:
> initialized
>
> The update strings could be stored in a Map with key containing the names
> (or indexes?) of the corresponding initialized lazy groups.
>
> 2) Generate dynamic update strings when there is at least 1 uninitialized
> group, or when there are more than N lazy groups. What should N be?
>
> Comments or suggestions?
>
> A related bug is that calling a setter on a lazy property only initializes
> that one lazy property. It should also initialize other properties in the
> same lazy group. This one is pretty easy to fix.
> Thanks,
> Gail
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list