I am using Eclipselink 2.7.6, Oracle 12c, Payara 5 and I get a conversion exception when running a query.
The Entity definition is:
@Column(name = "RUN_START_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date runStartTime;
@Column(name = "RUN_STOP_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date runStopTime;
The persistence.xml file has the following properties:
<properties>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.Oracle12Platform"/>
<property name="eclipselink.target-server" value="Glassfish"/>
</properties>
And I have added the following dependency to my POM.xml:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.oracle</artifactId>
<version>2.7.6</version>
</dependency>
Does anybody have any suggestions on what I could be doing wrong? I have seen a couple of other threads with regards to this but most don't have solutions/answers and the others seem to suggest what I have defined should be sufficient. I have this same code base working against MS SQL as well.
Update: I attempted a number of things based on comments including to use various types of Date/Timestamp formats the last of which was java.time.OffsetDateTime. I am getting the same error output:
Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.7.6.payara-p1): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [oracle.sql.TIMESTAMPTZ@38b7d502], of class [class oracle.sql.TIMESTAMPTZ], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[runStartTime-->ASR_RUN.RUN_START_TIME]] with descriptor [RelationalDescriptor(....ASRRun --> [DatabaseTable(ASR_RUN)])], could not be converted to [class java.time.OffsetDateTime].
at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:81)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToOffsetDateTime(ConversionManager.java:930)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:123)
at org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.convertObject(DatasourcePlatform.java:226)
at org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.getObjectValue(AbstractDirectMapping.java:611)
at org.eclipse.persistence.queries.ReportQueryResult.processItemFromMapping(ReportQueryResult.java:186)
As the message is always the same just the class name changes, I am still thinking that I have something configured improperly. I made sure to use the following in my POM file to make sure I was using the latest Date formats:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.oracle</artifactId>
<version>2.7.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 -->
<!--dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency-->
<!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8dms -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8dms</artifactId>
<version>19.6.0.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.6</version>
</dependency>
I tried various versions of the jdbc drivers as you can see from the commented version.
I'm still not sure what could be misconfigured.