emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

configure behavior when all columns values are null for some rows #194

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
3.0.1 but I read the source in 3.0.2 too.

Please describe the problem.  Unit tests are best!
call selectList when for some rows that represent objects, all the columns in 
the query contains null value for some rows.

What is the expected output? What do you see instead?
2 configurable options: return null or return new object (with null members). 
currently it return null for the objects with only null columns

Please provide any additional information below.
class:   org.apache.ibatis.executor.resultset.FastResultSetHandler
method:  protected Object getRowValue(ResultSet rs, ResultMap resultMap, 
CacheKey rowKey) throws SQLException
there is code:
resultObject = foundValues ? resultObject : null;
I would like a way to get the resultObject even if no value was found.
I don't understand why to use this foundValues and not simply return the 
resultObject(will be glad to know if you can explain), but assume there is a 
reason, anyway, I expect to get the Object for every raw, not null if there are 
no values. I guess that the solution is configuration with default set for 
backward compatablility.

Thanks ahead,
Sagi 

Original issue reported on code.google.com by sagi...@hotmail.com on 2 Dec 2010 at 9:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please consider using the id element or the notNullColumns attribute, see the 
online doc for more info.

Original comment by eduardo.macarron on 10 Jun 2012 at 2:33