Patrick Haller created OLINGO-1109:
--------------------------------------

             Summary: JPA silently dropping navigation properties if not found
                 Key: OLINGO-1109
                 URL: https://issues.apache.org/jira/browse/OLINGO-1109
             Project: Olingo
          Issue Type: Improvement
          Components: odata2-jpa
    Affects Versions: V2 2.0.8
            Reporter: Patrick Haller


We encountered an issue when creating a ProjectCost record, directly to be 
associated with its parent Project by setting a navigation property. The 
information encoded in { '__metadata': { uri: 'xyz' } } was correctly parsed in 
the Olingo stack, but in
{{JPALink.create() #174}}, the {{targetJPAEntity}} could not be resolved as the 
value 'xyz' was indeed wrong. The created data in persistence was missing the 
link to the parent entity, but the error went unnoticed as no exception was 
thrown.

I would suggest that {{JPALink.create}} should also {{throw 
ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND}}
like {{JPALink.delete}}. It seems that {{JPALink.modifyLink}} is also 
intentionally ignoring if the target entity cannot be found.

Not sure what behavior the OData specification documents here, but data loss 
should not go unnoticed, I think.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to