You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/04/01 20:01:00 UTC

[jira] [Commented] (OPENJPA-2851) argument CURRENT_DATE cannot handle java.time.LocalDateTime entity fields

    [ https://issues.apache.org/jira/browse/OPENJPA-2851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17313413#comment-17313413 ] 

ASF subversion and git services commented on OPENJPA-2851:
----------------------------------------------------------

Commit 6db4db7f512e67b7ea1e3aeb124a4e0343df79d8 in openjpa's branch refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=6db4db7 ]

OPENJPA-2851 fix CURRENT_DATE with LocalDate and LocalDateTime


> argument CURRENT_DATE cannot handle java.time.LocalDateTime entity fields
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-2851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2851
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 3.1.2
>         Environment: h2 database
>            Reporter: Karl Grosse
>            Assignee: Mark Struberg
>            Priority: Major
>
> 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")
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)