Reputation: 271
We are facing issue for writing Timestamp into Gemfire Region
We are fetching the data from the DB2 table and putting them into Gemfire region.
One timestamp typed column is in the DB2 table
For the region of the Gemfire, we have specified java.sql.Timestamp
type of field for Timestamp value.
From DB2 we are getting value for that field like 1993-01-01-08.23.35.148153
We uses PdxSerilizer for serializing and deserializing the data.
For writing the data into Gemfire, writeObject(String fieldName, Object value)
of PdxWriter
used.
After writing the data into region we are getting value in two part:
nanos 148000000
time 725898215148
For nanosecond, the value got trimmed at the time of writing the data into the Gemfire.
We want the value of nano second same as it is in the DB2 table.
Upvotes: 0
Views: 308
Reputation: 1301
To serialize java.sql.Timestamp
GemFire/Geode converts it to a long by calling getTime() method. According to the javadocs for Timestamp that gets you the milliseconds from epoch. If you want to preserve nanos, you will have to write an implementation of PDXSerializer.
Upvotes: 1