Question

I am inserting a list of object with java.util.date in format YYYY-MM-DDThh:mm:ssTZD (2008-09-26T14:34:59+02:00).

SQL:

INSERT INTO cdate (key,valuedate,user_id) VALUES(?,?,?)

BatchPreparedStatementSetter bpss = new MetaJdbc().setMetaBatchPreparedStatement(
                    list, userId);
getJdbcTemplate().batchUpdate(sql,bpss);

Date is in right format, but in PostgreSQL it saves only just like that: "2008-09-26 00:00:00+02"

Edit: I was in a hurry before... I did not give enough info, sorry.

Was it helpful?

Solution

Use java.sql.Timestamp instead. And by the way, your posted snippets barely giving us any hint.

OTHER TIPS

What is the type of the field in the database? Is it date or datetime?

Also, what is this MetaJdbc class? It may put the wrong type (DATE instead of TIMESTAMP)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top