[
https://issues.apache.org/jira/browse/DBUTILS-113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Osipov updated DBUTILS-113:
-----------------------------------
Attachment: DBUTILS-113.patch
I took the liberty to modify your patch but It results in two problems:
1. Unchecked cast which might be ignored
2. Some tests fail because you have changed "3" to "THREE"
Please run {{mvn test}} and see
{noformat}
Failed tests:
testInsertUsesGivenQueryRunner(org.apache.commons.dbutils.AsyncQueryRunnerTest):
(..)
testToArray(org.apache.commons.dbutils.BasicRowProcessorTest): expected:<3>
but was:<THREE>
testToBean(org.apache.commons.dbutils.BasicRowProcessorTest): expected:<3>
but was:<THREE>
testToBeanList(org.apache.commons.dbutils.BasicRowProcessorTest):
expected:<3> but was:<THREE>
testToMap(org.apache.commons.dbutils.BasicRowProcessorTest): expected:<3> but
was:<THREE>
testHandle(org.apache.commons.dbutils.handlers.ArrayHandlerTest):
expected:<3> but was:<THREE>
testHandle(org.apache.commons.dbutils.handlers.ArrayListHandlerTest):
expected:<3> but was:<THREE>
testHandle(org.apache.commons.dbutils.handlers.BeanHandlerTest): expected:<3>
but was:<THREE>
testHandle(org.apache.commons.dbutils.handlers.BeanListHandlerTest):
expected:<3> but was:<THREE>
testColumnNameHandle(org.apache.commons.dbutils.handlers.KeyedHandlerTest):
expected:<6> but was:<SIX>
testHandle(org.apache.commons.dbutils.handlers.KeyedHandlerTest):
expected:<3> but was:<THREE>
testColumnIndexHandle(org.apache.commons.dbutils.handlers.KeyedHandlerTest):
expected:<6> but was:<SIX>
testHandle(org.apache.commons.dbutils.handlers.MapHandlerTest): expected:<3>
but was:<THREE>
testHandle(org.apache.commons.dbutils.handlers.MapListHandlerTest):
expected:<3> but was:<THREE>
testNext(org.apache.commons.dbutils.ResultSetIteratorTest): expected:<3> but
was:<THREE>
Tests run: 223, Failures: 15, Errors: 0, Skipped: 0
{noformat}
> Add support for conversion of ResultSet strings to enums in the BeanProcessor
> -----------------------------------------------------------------------------
>
> Key: DBUTILS-113
> URL: https://issues.apache.org/jira/browse/DBUTILS-113
> Project: Commons DbUtils
> Issue Type: Improvement
> Reporter: Graylin Kim
> Priority: Minor
> Labels: patch
> Attachments: DBUTILS-113.patch, bean_enums.diff, bean_enums2.diff,
> bean_enums3.diff
>
>
> When using commons-dbutils I frequently use enum values with corresponding
> enum in the database. In this situation, using the BeanListHandler produces
> the following exception causing me to write a custom bean handler for enum
> conversion.
> {quote}
> Cannot set status: incompatible types, cannot convert java.lang.String to
> gov.nysenate.openleg.util.Storage$Status Query: SELECT * FROM changelog WHERE
> 1=1 AND time >= ? AND time <= ? Parameters: [2013-07-24 00:00:00, 2013-07-26
> 23:59:59]
> java.sql.SQLException: Cannot set status: incompatible types, cannot convert
> java.lang.String to gov.nysenate.openleg.util.Storage$Status Query: SELECT *
> FROM changelog WHERE 1=1 AND time >= ? AND time <= ? Parameters: [2013-07-24
> 00:00:00, 2013-07-26 23:59:59]
> at
> org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:363)
> at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:350)
> at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:288)
> {quote}
> It seems to me that commons-dbutils should be able to handle this conversion.
--
This message was sent by Atlassian JIRA
(v6.1#6144)