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

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

Zoltan Beleznay created OLINGO-1020:
---------------------------------------

             Summary: 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
    Affects Versions: V2 2.0.7
            Reporter: Zoltan Beleznay


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)