[hibernate-dev] HHH-7610 Embedded: emptiness and dirtiness
steve at hibernate.org
Fri Oct 24 09:08:11 EDT 2014
In general, yes, there is interest in this. I think quite a few folks have
asked for it, so certainly it would be nice to make it an option. We've
all just been busy lately.
As to your specific question, yes I think what you propose makes sense.
Namely, if this setting is enabled, I think it is reasonable to treat a
null component reference and an empty component reference as equivalent.
You are probably aware, but I just wanted to caution you that this solution
as-is makes a not-necessarily-true assumption that this
"hibernate.create_empty_composites.enabled" setting is set when the
Component is created. This is a general design problem with complete
open-ended-ness of the Configuration object. There really is not a way
around that in the 4.x code base as it currently sits. Just pointing out
that this solution is dependent on order of calls to the Configuration
Also, a minor point, but the if-statement to
set ComponentMetamodel#createEmptyCompositesEnabled should be simplified.
I added a line note to commit.
On Mon, Oct 20, 2014 at 4:08 AM, Guillaume Smet <guillaume.smet at gmail.com>
> Any interest in us pursuing this?
> We are obviously committed to update the documentation once we have
> validated it's the way to go.
> Thanks for your feedback.
> On Tue, Oct 14, 2014 at 3:23 PM, Guillaume Smet
> <guillaume.smet at gmail.com> wrote:
> > Hi all,
> > So, after a long time without any issue (rest assured we were busy
> > anyway!), we got around a new problem we would like to fix in ORM:
> > HHH-7610 .
> > It's a long standing complaint about the embedded and the fact that
> > empty components are returned from the ORM.
> > We had the "good" idea to fix it by overriding the getter to set the
> > value to an empty object if null and it's not really a good one: we do
> > a lot of unnecessary updates due to the fact that our entities are
> > considered dirty.
> > A coworker of mine (Laurent CCed) followed the instructions given by
> > Steve in HHH-7610 to implement a configuration setting to return an
> > empty component if all its properties is null:
> > see
> > -> we think this one should be ready to commit. It's for 4.3.x.
> > -> using all the tests with this new setting enabled triggers a few
> > errors but, after carefully reviewing them, they are all expected due
> > to the nature of this change.
> > We are wondering if we shouldn't also change the isDirty/equals...
> > stuff to consider 2 components equals if one is null and the other has
> > all its properties null: it sounds kinda logical to us considering ORM
> > already automatically transforms one to the other if we save then get
> > the entity.
> > We wrote a few tests to demonstrate the issue and we would like to
> > know if you would consider this a good idea or not to fix this in both
> > cases (settings on or off):
> > Thanks for your advice.
> > --
> > Guillaume
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
More information about the hibernate-dev