Yeah, seems like a JDBC driver issue having hard time guessing the
type of the result (which Cayenne takes from ResultSetMetadata). So
just to doublecheck, if you do #bind($MyNumericColumn 'int'), it
doesn't make a difference?
As for the solution if nothing works, Cayenne 3.0 has an ability to
set explicit result mapping via API:
http://cayenne.apache.org/doc/api/org/apache/cayenne/query/SQLTemplate.html#setResult(org.apache.cayenne.map.SQLResult)
Not sure 100% if it solves this problem, but let's check things one
step at a time...
Andrus
On Sep 28, 2009, at 5:58 PM, Evgeny Ryabitskiy wrote:
Hello to everyone!
After previous fix I can pass null values in parameters to
SQLTemplates.
It's working and it's cool!
Now I have one more issue... :
Here is query (very simple.. to focus on this issue, that I can't
avoid by changing SQL or add directives like #bind or #result)
SELECT isnull(#bind($MyNumericColumn), AnotherNumericColumn) AS
MyColumn FROM MyTable
If I pass some not null Decimal value it's working properly and
returns BigDecimal value.
But if I pass null or not pass anything.. it's still working! but
return type is java.lang.String .. course null now has special JDBC
type for it and JDBC converts my Numeric to String.
I have only one idea: pass JDBC type with my null in parameters
(like special class "JDBCTypedNull" with constructor and pass there
JDBC type or value type and map it to JDBC).
Any other suggestions?
Best regards,
Evgeny Ryabitskiy.