polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject EntityReference in ValueComposite 'side effect'
Date Sat, 17 Jun 2017 06:46:53 GMT
Gang,

the new EntityStoreTestSuite is once again finding "interesting" behavior
that is not documented.

If an Value composite has an Association to an Entity, but that entity is
not visible to the Value, deserialization will fail.

It is quite straight forward that it does, since serialization doesn't have
the benefit of, for instance, exposed services that does the creation in
the first place, which is a pattern that I typically follow.

However, that is not the end of it... This happens on creating the Value
composite as well, because during the build of the Value, the Constraints
check will actually load the referenced Entity IF (and only IF) there is an
UnitOfWork. If there is no UnitOfWork active, then that particular check is
skipped and the problem probably surface later (I can't figure that out
exactly).


Sooooo.... I think the documentation needs something like;

"For any Associations in Value composites, the Entity type referenced must
be visible in the module of the Value type."

And, then I thought, *let's check this during Model creation and give a
good exception*.

Well, that would have worked if not TypeLookUp now has a LazyInitialization
which get buggered up if called prior to completed, and everything else
breaks. So, I need to disable that until we can disable lazy-loading in
TypeLookUp during model building.


Cheers
-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message