You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2021/04/01 20:02:00 UTC
[jira] [Resolved] (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:all-tabpanel ]
Mark Struberg resolved OPENJPA-2851.
------------------------------------
Fix Version/s: 3.1.3
Resolution: Fixed
Hi Karl, please test with the latest snapshot!
> 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
> Fix For: 3.1.3
>
>
> 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)