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 2019/05/17 16:20:00 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.18.0)
2.0.3
> 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: 2.0.3
>
>
> 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
(v7.6.3#76005)