![]() I tried to make my own typeHandler for Ibatis, where I could convert the to a, and give it directly to the PreparedStatement. This seems to come from the util.Date class, which seems to have a default offset of -120 minutes, although I did not set that, and did not request any timezone to be set. When I am using Ibatis to insert a into Postgress, it gets “timezone corrected”, although I specifically told Postgress to store timestamps without timezones. When querying with SquirrelSQL, I can insert and retreive a timestamp to and from Postgress without it being changed. ![]() has no time component, so when you retreive it, your in the bean will have a 00:00 time. UPDATE: Okay, after spending the whole weekend with this problem I discovered that the trick I just described does noet work. Then, make your Ibatis sqlMap as usual, but for the timestamp column you put the following in the resultmap: javaType=”java. ![]() So: You have your normal bean, in which you use java. The fix is as simple as it is strange: Make Ibatis convert the timestamp into a java. I’ve tried really hard to circumvent this problem with custom setter methods (parsing the results myself), and using jodatime (a great java date and time replacement library). For some reason, the result returned by Postgres can not be converted back into a. However, when you want to retreive it, Ibatis returns a “StringIndexOutofBoundsException” at position 23. I am using Ibatis and PostgreSQL for this great project, However, we’ve recently ran into a strange problem where we store a into a postgress TIMEZONE column, which works fine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |