[teiid-issues] [JBoss JIRA] (TEIID-4054) OData - creation of entity (POST) returns exception (status code 500)

Ramesh Reddy (JIRA) issues at jboss.org
Thu Mar 17 16:47:00 EDT 2016


     [ https://issues.jboss.org/browse/TEIID-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ramesh Reddy resolved TEIID-4054.
---------------------------------
    Fix Version/s: 9.0
                   8.12.5
       Resolution: Done
           Labels: alpha3  (was: )


There were two issues
1) The Olingo libraries for the time/date/timestamp, they always parse the payload into Calender objects, and Teiid was not correctly converting them into the java.sql.Time, java.sql.Date, java.sql.Timestamp
2) The query contains the The Clob/Blob types as ClobType, BlobType, and during the SQL building they were checked for Blob/Clob instead of their respective types, thus they were treated as Objects. 

[~jdurani] The test also needs to be corrected. The Clob/Blob/SQLXML types are treated as "Edm.Stream" in Teiid. You can not directly pass the contents of "Edm.Stream" in the payload per OData spec. If you want to insert a Edm.Stream you need to send a PUT like

PUT http://localhost:8080/odata4/olingo_basic/Source/PostTable(4)/clobval
body: {contents of stream}

You can also DELETE 
DELETE http://localhost:8080/odata4/olingo_basic/Source/PostTable(4)/clobval

the GET
GET http://localhost:8080/odata4/olingo_basic/Source/PostTable(4)

Will get a URI of the clobval and

GET http://localhost:8080/odata4/olingo_basic/Source/PostTable(4)/clobval

should give you the steam contents.

BTW, in the XML payload you defined the "clobval" payload as "Binary", however the Olingo library nor the specification do not define the conversion between types(there may be blurb some where, if you see it please let me know). Also, in JSON I am not sure how one defines the type in payload, so the deserializers always choose the entity type definition while parsing the payload. Thus even though you defined as Binary, it will treat as Edm.Stream.

> OData - creation of entity (POST) returns exception (status code 500)
> ---------------------------------------------------------------------
>
>                 Key: TEIID-4054
>                 URL: https://issues.jboss.org/browse/TEIID-4054
>             Project: Teiid
>          Issue Type: Sub-task
>          Components: OData
>            Reporter: Juraj Duráni
>            Assignee: Ramesh Reddy
>              Labels: alpha3
>             Fix For: 9.0, 8.12.5
>
>
> Creation of entity returns exception \[1\]. Representation of entity \[2\]. Http request \[3\]. Header \[4\]. Same exception with of JSON format.
> \[1\]
> {code:plain}
> TEIID10076 Invalid conversion from type class java.lang.Object with value 'java.util.GregorianCalendar[time=4000,areFieldsSet=true,areAllFieldsSet=true,
> lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],f
> irstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=1970,MONTH=0,WEEK_OF_YEAR=1,
> WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,
> AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=4,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]' 
> to type class java.sql.Time
> {code}
> \[2\]
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
>    <category scheme="http://docs.oasis-open.org/odata/ns/scheme" />
>    <content type="application/xml">
>       <m:properties>
>          <d:intkey m:type="Int32">4</d:intkey>
>          <d:intnum m:type="Int32">4</d:intnum>
>          <d:stringkey>4</d:stringkey>
>          <d:stringval>value_4</d:stringval>
>          <d:booleanval m:type="Boolean">false</d:booleanval>
>          <d:decimalval m:type="Double">-20.4</d:decimalval>
>          <d:timeval m:type="TimeOfDay">00:00:04</d:timeval>
>          <d:dateval m:type="Date">2004-04-04</d:dateval>
>          <d:timestampval m:type="DateTimeOffset">2004-01-01T00:00:04Z</d:timestampval>
>          <d:clobval m:type="Binary">Y2xvYl92YWx1ZV8wMDAwNA==</d:clobval>
>       </m:properties>
>    </content>
> </entry>
> {code}
> \[3\]
> POST http://localhost:8080/odata4/olingo_basic/Source/PostTable(4)
> \[4\]
> Content-type: application/xml



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the teiid-issues mailing list