You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2017/01/20 16:30:26 UTC

[jira] [Updated] (ISIS-1562) Metamodel validator if forget to annotate @DomainObject(nature=ENTITY) with @PersistenceCapable

     [ https://issues.apache.org/jira/browse/ISIS-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Haywood updated ISIS-1562:
------------------------------
    Fix Version/s:     (was: 1.14.0)
                   1.16.0

> Metamodel validator if forget to annotate @DomainObject(nature=ENTITY) with @PersistenceCapable
> -----------------------------------------------------------------------------------------------
>
>                 Key: ISIS-1562
>                 URL: https://issues.apache.org/jira/browse/ISIS-1562
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.13.2
>            Reporter: Dan Haywood
>            Priority: Minor
>             Fix For: 1.16.0
>
>
> Also, RepositoryService#persist(...) is a no-op if the domain object passed in is not an entity; this should probably fail-fast.
> This was originally prompted by an obscure message being thrown in Memento#updateFieldsAndResolveState(...), as the result of an entity being treated as transient, because (a) the @PersistenceCapable annotation was accidentally omitted, and (b) a call to RepositoryService#persist(...) just did nothing.
> So, this ticket would be a fail-fast for that scenario.
> {code}
>     private void updateFieldsAndResolveState(final ObjectAdapter objectAdapter, final Data data) {
>         
>         boolean dataIsTransient = data.getOid().isTransient();
>         
>         if (!dataIsTransient) {
>            ...
>         } else if (objectAdapter.isTransient() && dataIsTransient) {
>            ...
>             
>         } else if (objectAdapter.isParentedCollection()) {
>            ...
>             
>         } else {
>            // THIS IS THE BRANCH THAT'S TRIGGERED IF @PersistenceCapable IS ACCIDENTALLY OMITTED.
>             final ObjectData od = (ObjectData) data;
>             if (od.containsField()) {
>                 throw new IsisException("Resolve state (for " + objectAdapter + ") inconsistent with fact that data exists for fields");
>             }
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)