polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject SPI issue?
Date Sun, 07 May 2017 04:16:45 GMT
Peddling with this JOOQ ES (or whatever it ends up being called), I found
an inconsistency in the EntityStore SPI.

public interface EntityStoreUnitOfWork
    EntityState newEntityState( EntityReference anIdentity,
EntityDescriptor entityDescriptor )
        throws EntityStoreException;

    EntityState entityStateOf( ModuleDescriptor module,
EntityReference anIdentity )
        throws EntityStoreException, EntityNotFoundException;

    String versionOf( EntityReference anIdentity ) throws EntityStoreException;


It is not consistent to pass the EntityDescriptor in newEntityState() but
not in entityStateOf(). In the latter case, it is expected that the
EntityStore have saved away the type, and able to look it up from the
Module, when the caller already have the EntityDescriptor readily available.

Can anyone think of a case where it is not better to pass the
EntityDescriptor from the caller?

It might be related to looking up via a super type, and if then saving,
then there is a chance that the "old fields" are no long present. And to
avoid that, push the whole "what is the lowest subclass of this identity"
to the entitystore.

I think my question is, what is the proper semantics around entity
subclasses? Is it really the "saved type" that is the deserialized type, or
is it the "requested type" that should be the deserialized type?

I am not sure either way, and would like to hear more arguments one way or
the other.

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

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