It seems to me that the <select> statement with resultClass="myClass"
attribute has
two radically different behaviours:
1) if "myClass" is some of the Java "elemantary standard classes"
(eg: Integer), Ibatis expects the resultset to contains just one
column, convertible
to a Integer.
2) otherwise, Ibatis construcs an instance of myClass (this implies that myClass
must have a non-arg constructor, and hence be mutable), and the calls
the "setters"
for each column of the result set (the case of a java Map, is a slight
variation).

Now, lets say I  have registered a global custom typehandler (say, for
converting SQL Dates to
JodaTime LocalDate). I would expect that Ibatis then would be smart
enough to say
to itself 'aha, I have a column of SQL DATE type, and the resultClass
is a LocalDate,
I have a CustomHandler for dealing to this...'). But this doesnt seem
to be the case,
i seems that Ibatis insists on the behaviour 2) (instantiate an empty
object, try to
assign the column value via setter).

Does this imply that it is impossible to specify an inmutable class
for the resultClass, even
when a custom type handler is available ?

-- 
Hernán J. González
http://hjg.com.ar/

Reply via email to