Hi,
I'm using Spring 2.5.6, ojdbc-14 and Java 6.
I have a StoredProcedure that has a date output.
This is my code:
Code:public GetVersionElementSP(DataSource ds) { super(ds, STORED_PROC_NAME); declareParameter(new SqlOutParameter("P_OUT_TIMESTAMP", Types.TIMESTAMP)); compile(); }The output is:Code:public void execute() throws Exception { Map<Object, Object> inParams = new HashMap<Object, Object>(); Map<?, ?> outParams = execute(inParams); Timestamp rawDate = (Timestamp) outParams.get("P_OUT_TIMESTAMP"); log.info(outParams.get("P_OUT_TIMESTAMP")); log.info(rawDate);
2011-04-05 00:00:00.0
But if I check in the database, the timestamp should be:
2011-04-05 09:04:19.0
If I use JdbcTemplate.queryForObject(), the output is correct (2011-04-05 09:04:19.0)
I also tried Types.DATE, OracleTypes.TIMESTAMP, OracleTypes.DATE as a parameter for my SqlOutParameter but the output is still wrong. I also tried to cast the outParams.get("P_OUT_TIMESTAMP") to java.util.Date and java.sql.Date
Is there anything I missed or done wrong?
Thanks!


Reply With Quote
