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

argument CURRENT_DATE cannot handle java.time.LocalDateTime entity fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.2
    • 3.2.0
    • jpa
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: