Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-293

Unable to POST an entity with a DateTime type field using underlying JPA model

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • V2 1.2.0
    • V2 2.0.0
    • odata2-jpa
    • None
    • Tomcat 7.0.45
      Eclipselink 2.5.0

    Description

      Attempting to supply a value for a DateTime field in a POST operation yields this error message:

      <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code/>
      <message xml:lang="en">"OData - JPA Runtime: JPA create request is not correct"</message>
      <innererror>class org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException : "OData - JPA Runtime: Internal error [argument type mismatch]"</innererror>
      </error>

      I have tried to declare the underlying field a few ways:

      @Temporal(TemporalType.TIMESTAMP)
      protected Date lastUpdate;

      and

      @Temporal(TemporalType.TIMESTAMP)
      protected Calendar lastUpdate;

      The first configuration fails, bit the second (using java.util.Calendar) seems to work.

      In the failing case, I have tried POST-ing both as XML and JSON using the proper date format for each.

      I can work around this for my specific application, but I expect there will be others that might prefer or need to use Date.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            chandan.v.a Chandan V.A
            rrainey_sap Riley Rainey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment