Hi,
i face a problem when i need to insert a timestamp with milliseconds into a oracle db. The console output show a timestamp with milliseconds, but the inserted timestamp have no milliseconds. U can see a SQLListener with the prefix "Query:" which shows the sql-statement of the insert. This insert statement have no milliseconds at all.
timestamp = 2017-03-14 17:54:36.084
Query: insert into WSM_KOMMUNIKATIONEN (ID, DEPL_ID, BEGINN_TIMESTAMP) values (13602, 1, timestamp '2017-03-14 17:54:36') executed in 47 miliseconds
Query: select * from ( select qk.BEGINN_TIMESTAMP from WSM_KOMMUNIKATIONEN qk where qk.ID = 13602 ) where rownum <= 2 executed in 15 miliseconds
Timestamp @ db = 2017-03-14 17:54:36.0
Here the code:
configuration.addListener(new PrintStreamSQLListener());
SQLQueryFactory factory = new SQLQueryFactory(configuration, dataSource);
QKommunikationen qk = new QKommunikationen("qk");
Long id = ThreadLocalRandom.current().nextLong(1000, 20000 + 1);
DateTime dateTime = new DateTime();
Timestamp timestamp = new Timestamp(dateTime.getMillis());
System.out.println("timestamp = " + timestamp);
factory.insert(qk).columns(
qk.id, qk.deplId, qk.beginnTimestamp).values(id, 1L, timestamp).execute();
Timestamp dbTimestamp = factory.select(qk.beginnTimestamp).from(qk).where(qk.id.eq(id)).fetchOne();
factory.delete(qk).where(qk.id.eq(id));
factory.getConnection().commit();
factory.getConnection().close();
System.out.println("Timestamp @ db = " + dbTimestamp);
And a snippet of QKommunikationen with the timestamp column:
public final DateTimePath<java.sql.Timestamp> beginnTimestamp = createDateTime("beginnTimestamp", java.sql.Timestamp.class);
I have no idea how to solve this issue. And hope u guys can help me to fix this.
Greetings w0rst