Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2851

argument CURRENT_DATE cannot handle java.time.LocalDateTime entity fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2
    • Fix Version/s: 3.2.0
    • Component/s: jpa
    • Labels:
      None
    • Environment:
      h2 database

      Description

      Using CURRENT_DATE as argument in queries for LocalDateTimeFields yields a 

      org.apache.openjpa.persistence.ArgumentException: Attempt to compare incompatible types "class java.time.LocalDateTime" and "class java.util.Date".

       

      Field in entity:

      @NotNull
      @Column(name = "USEDUNTIL", nullable = false)
      private LocalDateTime usedUntil;

      Example Query:

      @NamedQuery(name = QUERY_COUNT_BY_IDS,
      query = "SELECT COUNT(t) FROM Dokumente t WHERE t.dokumentId IN :dokumentId AND t.usedUntil >= CURRENT_DATE")

       

        Attachments

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              Charlemagne Karl Grosse
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: