[
https://issues.apache.org/jira/browse/DBUTILS-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henri Yandell closed DBUTILS-42.
--------------------------------
Resolution: Fixed
svn ci -m "Merging in Dab Fabulich's work on
https://svn.apache.org/repos/asf/commons/sandbox/dbutils/bugfixing from
-r741987:747723. Resolving DBUTILS-34 - DBUTILS-37 - DBUTILS-29 - DBUTILS-14 -
DBUTILS-31 - DBUTILS-39 - DBUTILS-41 - DBUTILS-44 - DBUTILS-33 - DBUTILS-42 -
DBUTILS-40"
Sending pom.xml
Sending src/java/org/apache/commons/dbutils/BasicRowProcessor.java
Sending src/java/org/apache/commons/dbutils/BeanProcessor.java
Sending src/java/org/apache/commons/dbutils/QueryRunner.java
Adding
src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
Sending
src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
Sending src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
Sending
src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
Deleting
src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java
Sending src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
Sending src/test/org/apache/commons/dbutils/BaseTestCase.java
Adding src/test/org/apache/commons/dbutils/QueryRunnerTest.java
Transmitting file data .........
Committed revision 747724.
> Object with Long or Decimal got initial zero value while database field is
> null
> -------------------------------------------------------------------------------
>
> Key: DBUTILS-42
> URL: https://issues.apache.org/jira/browse/DBUTILS-42
> Project: Commons DbUtils
> Issue Type: Improvement
> Affects Versions: 1.1
> Environment: JDK 5.0, MSSQL 2000
> Reporter: Matt Jiang
> Fix For: 1.2
>
> Attachments: BeanProcessor-fixed.diff, BeanProcessor.diff,
> BeanProcessorAlternativePatch.diff
>
>
> While I use dbutil1.1, I got a big different implementation betweeb 1.0 and
> 1.1.
> Given a Java object, it has a property with Long data type; mapping to
> database, its table field datatype is bigint.
> If it has a record and its value is null.
> In 1.0 implementation, if I load entity, then we can see the property in Java
> object is also null.
> But in 1.1 implementation, the Java object will got a Long object with 0
> inside.
> This behavior change does big impact if I upgrade from 1.0 to 1.1. It might
> make application logic fail because origional null status now become a
> Long(0) value to map to null value in database.
> I suggest to change it back. If null value in database, then mapped Java
> object should be null as well, not new a Long(0) to be a initial value.
> Below is the code snapshot I used to execute query, and I use jTDS 1.2 as
> JDBC driver
> {code}
> public List<E> executePreparedQuery(String sql, Object[] params, Class clazz)
> throws SQLException {
>
> Connection cnct = getConnection();
> QueryRunner qRunner = new QueryRunner();
> ResultSetHandler rsHandler = new BeanListHandler(clazz);
> List<E> entities = null;
> try {
> convertDateIn(params);
> entities = (List<E>) qRunner.query(cnct, sql, params, rsHandler);
> }
> catch (SQLException e) {
> e.printStackTrace();
> throw e;
> }
> finally {
> closeConnection();
> }
> return entities;
> }
> {code}
> Hope this helps.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.