[ 
https://issues.apache.org/jira/browse/OLINGO-1109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15968077#comment-15968077
 ] 

Michael Bolz commented on OLINGO-1109:
--------------------------------------

Hi [~patrickmhaller],

The OData specification itself does not documents how to handle such a case.
This is more based on the (server side) implementation and in our case in the 
JPA Processor.

I will take a look into but currently I think your suggestion with throwing an 
exception (instead of loosing the link) would be a good solution.

Best Regards, Michael

> 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
>            Assignee: Michael Bolz
>
> 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