You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "skis (JIRA)" <ji...@apache.org> on 2014/09/20 18:52:34 UTC
[jira] [Comment Edited] (DBUTILS-115) Enhance BeanProcessor to
support Joda DateTime
[ https://issues.apache.org/jira/browse/DBUTILS-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14142108#comment-14142108 ]
skis edited comment on DBUTILS-115 at 9/20/14 4:52 PM:
-------------------------------------------------------
I am not sure if the apache community would add that feature, As joda library is maintained by a third party and any bugs and issues identified with respect to joda will need to be addressed by the third party and not apache.
That being said, I suppose you already know this; The other option apart from what you did to support your need is to create a subclass and implement the functionality that you need.
was (Author: sriharshareddyk):
I am not sure if the apache community would add that feature as joda library is maintained by a third party and any bugs and issues identified with respect to joda will need to be addressed by the third party and not apache.
That being said, I suppose you already know this; The other option apart from what you did to support your need is to create a subclass and implement the functionality that you need.
> Enhance BeanProcessor to support Joda DateTime
> ----------------------------------------------
>
> Key: DBUTILS-115
> URL: https://issues.apache.org/jira/browse/DBUTILS-115
> Project: Commons DbUtils
> Issue Type: Improvement
> Affects Versions: 1.5
> Reporter: Bill Comer
> Labels: features
>
> We use the popular org.joda.time.DateTime to map all our Date fields in our POJOs.
> Could this be added to BeanProcessor.callSetter(....)
> I have done this local change that appears to work for me.
> if (value instanceof java.util.Date) {
> final String targetType = params[0].getName();
> if ("java.sql.Date".equals(targetType)) {
> value = new java.sql.Date(((java.util.Date) value).getTime());
> } else
> if ("java.sql.Time".equals(targetType)) {
> value = new java.sql.Time(((java.util.Date) value).getTime());
> } else
> if ("java.sql.Timestamp".equals(targetType)) {
> value = new java.sql.Timestamp(((java.util.Date) value).getTime());
> } else
> if ("org.joda.time.DateTime".equals(targetType)) {
> if (value instanceof java.sql.Timestamp) {
> value = new DateTime((java.sql.Timestamp)value);
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)