[hibernate-dev] HHH-7610 Embedded: emptiness and dirtiness

Guillaume Smet guillaume.smet at gmail.com
Tue Oct 14 09:23:54 EDT 2014

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 https://github.com/openwide-java/hibernate-orm/commit/a219fd38c0a80e6bf0a5de41f31e49ee83f00ccf
-> 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.


More information about the hibernate-dev mailing list