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

Michael Bolz commented on OLINGO-824:
-------------------------------------

Hi [~Johannes],

Thanks for testing and feedback.

I added some more tests ([\[OLINGO-824\] Added test for fixed JoinColumns on 
EDM 
creation|https://git1-us-west.apache.org/repos/asf?p=olingo-odata2.git;a=commit;h=4752ec10a7ad694f491ad0712cc1ddc309679bf6])
 and merged with master ([\[OLINGO-824\] Merge branch 
'OLINGO-824_FacetsOnJoinColumns'|https://git1-us-west.apache.org/repos/asf?p=olingo-odata2.git;a=commit;h=2a22911dc2d9b8d23ce304404cd940c219b1df69]).

The fix is then available with next release.

Best Regards,
Michael

> Incorrect Facets Of JoinColumns
> -------------------------------
>
>                 Key: OLINGO-824
>                 URL: https://issues.apache.org/jira/browse/OLINGO-824
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.5
>            Reporter: Johannes Hoenger
>            Assignee: Michael Bolz
>         Attachments: Stracktrace.JPG
>
>
> I recognised a potential bug in the JPA processor. I have an entity with the 
> following structure:
> {code:title=A.java}
> public class A {
>        @Id
>        @Column(name = "ID", nullable = false)
>        private String id;
>        @ManyToOne(optional = true)
>        @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID" , nullable 
> = true)
>        private A parent;
> }
> {code}
> Notice the self reference from "parent" to "id". While the *"id" field can 
> not be set null* the field *"parent" is nullable*. In the JPA context, this 
> definition can be interpreted.
> Lets have a look at the following entity instances:
> ||ID||PARENT||
> |1|null|
> |2|1|
> While the serialization of Olingo works perfectly fine for the instance with 
> id 2, it fails for the instance with id 1. An EdmSimpleTypeException is 
> thrown and the following error is returned:
> {code:javascript}
> {
>     "error": {
>         "code": null,
>         "message": {
>             "lang": "en",
>             "value": "An exception of type 'EdmSimpleTypeException' occurred."
>         }
>     }
> }
> {code}
> A closer look into the sources (see attached screenshot) seems to indicate 
> that the "nullable" attribute for the field "parent" is retrieved from the 
> referenced field "id" instead of "parent" itself.
> I also noticed that this issue does not arise, if nullable attribute of the 
> "id" field is set to true.



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

Reply via email to