[teiid-issues] [JBoss JIRA] (TEIID-5599) When creating an entity via POST message, it is expected, that the returned message includes the primary key of the newly created instance. This is not the case currently

Christoph John (Jira) issues at jboss.org
Mon Jan 14 15:42:03 EST 2019


    [ https://issues.jboss.org/browse/TEIID-5599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13681996#comment-13681996 ] 

Christoph John edited comment on TEIID-5599 at 1/14/19 3:41 PM:
----------------------------------------------------------------

Hello Steven,
if I do not provide a value for idProfile I get an error. The communication for it looks as follows:

1. request: 

POST Account HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"uuidUser":"65820574-7525-463b-9d20-5ee133a06b94"}
--batch_id-1547497985610-21
Content-Type:application/http
Content-Transfer-Encoding:binary

2. response:
HTTP/1.1 400 Bad Request
Content-Type: application/json;ieee754compatible=true;odata.metadata=minimal
Content-Length: 157

{"error":{"code":"TEIID30089","message":"TEIID30089 Required parameter 'my_nutri_diary.Account.idProfile' has no value was set or is an invalid parameter."}}
--batch_37bbb02c-8f9d-42ea-a56f-bcdef07b8568--

3. The relevant metadata:
<EntityType Name="Account">
<Key>
<PropertyRef Name="idProfile"/>
</Key>
<Property Name="idProfile" Type="Edm.Int64" Nullable="false">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`idProfile`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="uuidUser" Type="Edm.String" Nullable="false" MaxLength="36">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`uuidUser`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<NavigationProperty Name="Avatar_fkAvatarToAccount" Type="my_nutri_diary.Avatar" Nullable="false"/>
<NavigationProperty Name="BodyWeight_fkBodyWeightToAccount" Type="Collection(my_nutri_diary.BodyWeight)"/>
<NavigationProperty Name="ConfigOptions_fkConfigOptionsToAccount" Type="my_nutri_diary.ConfigOptions" Nullable="false"/>
<NavigationProperty Name="Profile_fkProfileToAccount" Type="my_nutri_diary.Profile" Nullable="false"/>
<Annotation Term="teiid.NAMEINSOURCE">
<String>`Account`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:ALLOW_MATVIEW_MANAGEMENT">
<String>false</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_ONERROR_ACTION">
<String>WAIT</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_SHARE_SCOPE">
<String>NONE</String>
</Annotation>
</EntityType>

I am not sure what you mean with Teiid/source metadata, would the vdb export as xml help you here?

Update: I also should mention, that I cannot set a primary key to anything different than not null in the mysql database. 

Best regards,
 Christoph


was (Author: cjohn001):
Hello Steven,
if I do not provide a value for idProfile I get an error. The communication for it looks as follows:

1. request: 

POST Account HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"uuidUser":"65820574-7525-463b-9d20-5ee133a06b94"}
--batch_id-1547497985610-21
Content-Type:application/http
Content-Transfer-Encoding:binary

2. response:
HTTP/1.1 400 Bad Request
Content-Type: application/json;ieee754compatible=true;odata.metadata=minimal
Content-Length: 157

{"error":{"code":"TEIID30089","message":"TEIID30089 Required parameter 'my_nutri_diary.Account.idProfile' has no value was set or is an invalid parameter."}}
--batch_37bbb02c-8f9d-42ea-a56f-bcdef07b8568--

3. The relevant metadata:
<EntityType Name="Account">
<Key>
<PropertyRef Name="idProfile"/>
</Key>
<Property Name="idProfile" Type="Edm.Int64" Nullable="false">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`idProfile`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="uuidUser" Type="Edm.String" Nullable="false" MaxLength="36">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`uuidUser`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<NavigationProperty Name="Avatar_fkAvatarToAccount" Type="my_nutri_diary.Avatar" Nullable="false"/>
<NavigationProperty Name="BodyWeight_fkBodyWeightToAccount" Type="Collection(my_nutri_diary.BodyWeight)"/>
<NavigationProperty Name="ConfigOptions_fkConfigOptionsToAccount" Type="my_nutri_diary.ConfigOptions" Nullable="false"/>
<NavigationProperty Name="Profile_fkProfileToAccount" Type="my_nutri_diary.Profile" Nullable="false"/>
<Annotation Term="teiid.NAMEINSOURCE">
<String>`Account`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:ALLOW_MATVIEW_MANAGEMENT">
<String>false</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_ONERROR_ACTION">
<String>WAIT</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_SHARE_SCOPE">
<String>NONE</String>
</Annotation>
</EntityType>

I am not sure what you mean with Teiid/source metadata, would the vdb export as xml help you here?

Best regards,
 Christoph

> When creating an entity via POST message, it is expected, that the returned message includes the primary key of the newly created instance. This is not the case currently
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TEIID-5599
>                 URL: https://issues.jboss.org/browse/TEIID-5599
>             Project: Teiid
>          Issue Type: Bug
>            Reporter: Christoph John
>            Assignee: Steven Hawkins
>            Priority: Critical
>
> The following communication shows the issue. What I am doing here is to create a new Account entity via post request. My underlaying mysql database requires the primary key in the table to be set to NN (not null), hence, a value must be provided. Moreover the primary key is set to autoincrement and is generated by the database. The only execepted value here seems to be, to provide the key with value=0. The object is created in the database as expected. However, Teiid answers with the created object, but again with the primary key (idProfile) set as zero, instead to provide the newly created primary key.
> POST Account HTTP/1.1
> Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
> Accept-Language:de-DE
> Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
> {"uuidUser":"65820574-7525-463b-9d20-5ee133a06b94","idProfile":"0"}
> --batch_id-1547485733072-21
> Content-Type:application/http
> Content-Transfer-Encoding:binary
> The response:
> HTTP/1.1 201 Created
> Location: http://localhost/odata4/svc/my_nutri_diary/Account(0)
> Content-Type: application/json;ieee754compatible=true;odata.metadata=minimal
> Content-Length: 147
> {"@odata.context":"http://localhost/odata4/svc/my_nutri_diary/$metadata#Account","idProfile":"0","uuidUser":"65820574-7525-463b-9d20-5ee133a06b94"}
> --batch_e834eb7c-df0d-4e22-a423-78cd3638955f
> Content-Type: application/http
> Content-Transfer-Encoding: binary



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the teiid-issues mailing list