Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA TemporalType.TIMESTAMP mapped to DATE in oracle9: errors on INSERT stmt

567350Aug 9 2007 — edited Aug 16 2007
Hi,

we have a legacy Oracle 9i Database which I have to access from a Java Webapp using Toplink JPA (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))).

When I am inserting a new record into a table, I get a foreign-key constraint violation where the constraint is definitely not violated. It seems to be a problem related to a "neighbour" column which is of type DATE in the database and mapped to a java.util.Date in the JPA object. the TemporalType is set to TIMESTAMP (as we need date+time).

when we insert NULL as a value for the Date-attribute the insert works, setting a value (e.g. new Date()) on the JPA object brings up the FK-constraint violation when calling EntityManager.persist() on the object.

When I change the TemporalType to DATE instead of TIMESTAMP the insert/persist operation works. Somehow it seems that there is a conflict between the DATE-typed column in the Database and the TemporalType.TIMESTAMP in JPA.

Are there any known issues regarding this behaviour? any workarounds? (btw: it is unlikely that it will be possible to change the type of the database column from DATE to TIMESTAMP).

regards,
HANS

Message was edited by:
hanzz
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2007
Added on Aug 9 2007
4 comments
6,986 views