Hello,
I'm currently wrecking my nerves on an issue I thought to be very simple using JPA via Toplink. I have defined an Entity-Class called Aufgabe with a persistent field startDate. This field is mapped to a database table in my local Oracle XE of type TIMESTAMP.
The specific part of the entity class looks as follows:
@Temporal(value=TemporalType.TIMESTAMP)
private java.util.Date _startdatum;
When I deploy my application to Glassfish, the verifier signals 0 errors/warnings, but when I query the database via JPA for Aufgabe-Objects, I get the following exception:
Exception [TOPLINK-3002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.ConversionException
Exception Description: The object [oracle.sql.TIMESTAMPLTZ_at_96af55], of class [class oracle.sql.TIMESTAMPLTZ], from mapping [oracle.toplink.essentials.mappings.DirectToFieldMapping[startdatum-->AUFGABEN.STARTDATUM]] with descriptor [RelationalDescriptor(myapp.Aufgabe --> [DatabaseTable(AUFGABEN)])], could not be converted to [class java.util.Date].
I tried omitting the @Temporal annotation (what is invalid), I tried changing to java.sql.Date without the annotation, resulting in nearly the same error.
What exactly am I doing wrong? Should I use Timestamp instead of Date? Should I change the column type in the database from TIMESTAMP to DATE? Seems JPA is not as easy as I thought.
Thank you for your help!
Hendrik Busch
[Message sent by forum member 'hbusch' (hbusch)]
http://forums.java.net/jive/thread.jspa?messageID=202435