Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] TemporalType.TIMESTAMP and Oracle DATE columns

Hello everyone,

I am encountering the following situation: (tested using EclipseLink 2.1.3)

1. Consider an Oracle schema a table contains one column, defined as type DATE 2. The corresponding entity maps this column as a java.util.Date, annotated with TemporalType.TIMESTAMP 3. Within a transaction create a new instance of this entity, and set the field of the column to new Date()
4. Persist it to the persistence context and commit the transaction
5. The (now detached) entity is merged back into the persistence context using EntityManager.merge()
6. The transaction is commited again

Surprisingly, EclipseLink issues an UPDATE of this record to the database although the entity
has obviously not been changed between the first and the second commit.

After some debugging I realized that the cause of this is an inconsistency in the granularity
of the time component between the entity and its backup clone.
The backup clone - which has been read from the database within the merge() operation - does not contain milliseconds information, while the entity itself still contains the original Date object, storing milliseconds.

I would expect that in case that eclipselink server session is running on the oracle platform it should be able to detect that we have a DATE column here which is not capable of storing millis/nanos and hence should not use these for change detection.

Is this behavior intended?


Thank you and best regards,
Patric






Back to the top