JoeSB
Sep 22nd, 2004, 04:20 AM
Hi all,
I'm new to Spring, but as far as it goes, I like it.
I have a couple question here, hope you can help me out.
1. I tried to update a row in database using SqlUpdate.update(object[]) method. Since some of the field in the row may not be set, sometimes some field in input array will be null.
When I execute the code I got exception saying "Driver not capable". I figure out that it only happen when any of the parameter i passed to update([]) method was null.
The field that was null does not have NOT NULL constrain in DB. And it works If I modified the sql and put "null" in the sql string where the value should have been.
I know that if I set the PreparedStatement directly I can use its setNull() method. However, that seems like a hack to me. Another place I look is PreparedStatementSetter but i don't think that's the right way.
I use JdbcOdbc pooled with DBCP with FireBird DB.
2. Currently, When I want to do query, I subclass all my query from MAppingSqlQuery. And When I want to do Update, Insert or Delete, I subclass then from SqlUpdate.
Is this what I should be doing. Or is it any better pattern you would use. Many people in here seems to use JDbcTemplate Directly.
Thanks
I'm new to Spring, but as far as it goes, I like it.
I have a couple question here, hope you can help me out.
1. I tried to update a row in database using SqlUpdate.update(object[]) method. Since some of the field in the row may not be set, sometimes some field in input array will be null.
When I execute the code I got exception saying "Driver not capable". I figure out that it only happen when any of the parameter i passed to update([]) method was null.
The field that was null does not have NOT NULL constrain in DB. And it works If I modified the sql and put "null" in the sql string where the value should have been.
I know that if I set the PreparedStatement directly I can use its setNull() method. However, that seems like a hack to me. Another place I look is PreparedStatementSetter but i don't think that's the right way.
I use JdbcOdbc pooled with DBCP with FireBird DB.
2. Currently, When I want to do query, I subclass all my query from MAppingSqlQuery. And When I want to do Update, Insert or Delete, I subclass then from SqlUpdate.
Is this what I should be doing. Or is it any better pattern you would use. Many people in here seems to use JDbcTemplate Directly.
Thanks