You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Michael Bolz (JIRA)" <ji...@apache.org> on 2016/09/07 21:59:20 UTC

[jira] [Commented] (OLINGO-1020) Association Multiplicity cannot set to 0..1 just 1

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

Michael Bolz commented on OLINGO-1020:
--------------------------------------

Hi [~ZoltanBeleznay],

Thanks for finding this issue and the good description.
[This commit|https://git1-us-west.apache.org/repos/asf?p=olingo-odata2.git;a=commit;h=8b40fff59763818af86a249828784927b8ff8cd2] should fix the problem.
Can you please test the solution and give feedback.

Best Regards, Michael

> Association Multiplicity cannot set to 0..1 just 1
> --------------------------------------------------
>
>                 Key: OLINGO-1020
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1020
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.7
>            Reporter: Zoltan Beleznay
>            Assignee: Michael Bolz
>
> Association Multiplicity cannot set to 0..1 just 1
> We created some navigation like the following (in the many side):
> 	@ManyToOne
> 	@PrimaryKeyJoinColumn(name = "SIDE_ONE_OBJECT_ID")
> 	private OneObject parentOneObject;
> and from the other side:
> 	@OneToMany(mappedBy = "parentOneObject")
> 	private List<ManyObject> manyObjects;
> but it creates the following part of the metadata:
> 	<Association Name="ManyObject_OneObject_One_Many0">
> 		<End Type="Service.ManyObject" Multiplicity="*" Role="ManyObject"/>
> 		<End Type="Service.OneObject" Multiplicity="1" Role="OneObject"/>
> 	</Association>
> We would like to see in the one side the 0..1 multiplicity, so we changed the annotations to the following:
> 	@ManyToOne(optional = true)
> 	@JoinColumn(name = "ACTION_PARENT_WORK_PACKAGE_ID", insertable = false, updatable = false, nullable = true)
> 	private OneObject parentOneObject;
> and from the other side:
> 	@OneToMany(mappedBy = "parentOneObject")
> 	private List<ManyObject> manyObjects;
> We expected the following result in metadata:
> 	<Association Name="ManyObject_OneObject_One_Many0">
> 		<End Type="Service.ManyObject" Multiplicity="*" Role="ManyObject"/>
> 		<End Type="Service.OneObject" Multiplicity="0..1" Role="OneObject"/>
> 	</Association>
> But it did not bring us the expected behaviour and the corresponding part of the metadata remained the same.
> The 0..1 is accesible via the EdmMultiplicity.ZERO_TO_ONE enum, and it is part of the OData documentation.



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