Details
Description
Works perfectly in OpenJPA 2.0.1.
Regression in OpenJPA 2.1.0, 100% reproducible exception.
Exception:
SEVERE: Failed to execute query "select max(h.loadTimestamp) from Header h where h.code=?1 and h.period=?2". Check the query syntax for correctness. See nested exception for details.
<openjpa-2.1.0-r422266:1071316 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Failed to execute query "select max(h.loadTimestamp) from Header h where h.code=?1 and h.period=?2". Check the query syntax for correctness. See nested
exception for details.
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:305)
at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:319)
at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:343)
... my code ...
Caused by: java.lang.ClassCastException: Cannot convert object
"2011-04-25 15:48:31+02" of type "class org.postgresql.util.PGobject"
into an instance of "class java.sql.Timestamp".
at org.apache.openjpa.kernel.Filters.convert(Filters.java:336)
at org.apache.openjpa.kernel.Filters.convert(Filters.java:265)
at org.apache.openjpa.jdbc.kernel.exps.UnaryOp.load(UnaryOp.java:125)
at org.apache.openjpa.jdbc.kernel.ProjectionResultObjectProvider.getResultObject(ProjectionResultObjectProvider.java:78)
at org.apache.openjpa.kernel.QueryImpl$PackingResultObjectProvider.getResultObject(QueryImpl.java:2075)
at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1330)
at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1242)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
... 12 more
Entity:
@Entity
@Table(name = "headers")
@DataCache(enabled = false)
public class Header {
@Id
@GeneratedValue
private long id;
@Column(nullable = false)
private String code;
@Column(nullable = false)
private int period;
@Column(nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Timestamp loadTimestamp;
...
}
Table (autogenerated by OpenJPA 2.0.1):
create table public.headers (
id int8 not null,
loadtimestamp abstime not null,
period int4 not null,
code varchar(255) not null,
primary key (id)
);
Attachments
Issue Links
- is related to
-
OPENJPA-1726 Clean up OpenJPA test case failures for PostgreSQL
- Closed
- relates to
-
OPENJPA-1710 OpenJPA generates ABSTIME for a TIMESTAMP field for Postgres 8.4
- Closed