[hibernate-dev] HHH-9440 - full instantiation of composites

Sanne Grinovero sanne at hibernate.org
Tue Dec 19 04:52:09 EST 2017


Haven't thought it through and I'm possibly not aware of all
consequences but I'd be curious to hear more about why you'd be
completely in disagreement with having such a feture for any model,
inlcuding entities.

We have since recently "refential caching" which requires entities to
be fully immutable, and also a feature request to have a global option
to run the whole SessionFactory in "read only mode".

For both cases I'd prefer to see the entities to be mapped as really
immutable rather than having to stick to trusting the users about not
making changes to them.
We could even consider enabling such features as referential caching
automatically when we detect the entity to be (really) immutable, that
would be a great usability improvement as such performance
improvements could be applied without the users having to know about
such aspects.

Not least it would simply HHH-9440 as people wouldn't need to
understand where this can be done or not: another usability win.

Thanks,
Sanne


On 18 December 2017 at 21:12, Steve Ebersole <steve at hibernate.org> wrote:
> OK then...
>
> HHH-9440 is requesting to allow full instantiation of a composite (i.e.
> treat its state as final).  E.g.:
>
> @Embeddable
> class Name {
>     private final String first;
>     private final String last;
>
>     public Name(String first, String last) {
>         ...
>     }
> }
>
> I wanted to see what everyone thought of this.  Personally I am fine with
> this, provided:
>
>    1. We limit this to composites.  The original request wanted entities as
>    well, which I completely disagree with
>    2. Limit this such that none of the composite's state can be lazy if
>    using this feature.  It *can* have lazy associations because that still
>    injects a reference for that attribute
>
> Thoughts?
>
> On Mon, Dec 18, 2017 at 3:06 PM Steve Ebersole <steve at hibernate.org> wrote:
>
>> HHH-9440 is re
>>
> _______________________________________________
> 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