|
From: Rod J. <rod...@in...> - 2003-08-16 09:22:24
|
All, A user has suggested in the forums that we should have an option where the ResultSet isn't read only in JdbcTemplate. For example, to allow the use of updateable result sets. I wanted to use an Oracle-specific method recently, so I added the getUnderlyingResultSet() method (in 0.9.1). However, I think there probably is a need to address this in general. Some thoughts on options: 1. Add boolean property to JdbcTemplate controlling whether to return the real result set. Of course this would affect all uses, not just the single case that needed it 2. Remove ReadOnlyResultSet and give the user a ResultSet as in the original version. I'm not into the idea of constraining people in general, and I wasn't specially bothered about the possibility of the user calling "bad" methods. Maybe we could improve the Javadoc to really make it clear which methods are acceptable. 3. Let more methods through in ReadOnlyResultSet. Only the navigation methods should really be off limits. 4. Replace ReadOnlyResultSet with an AOP-advised proxy to the real result set, which would allow a pointcut to specify which methods are allowed and which should through UnsupportedOperationException(). This might have a small impact on performance, and would complicate stack traces, so although I think it would work well I doubt it's very wise. I'd probably chose 2 (simplicity is good!) but let's vote on it. Btw I think mock object based tests should give us a good way of ensuring that our connection, statement and result set closure is correct. I think this is also something we need to get bulletproof before 1.0. I'm leaving for Colorado for an Enterprise Architecture Summit this afternoon and will be effectively offline till Wed 27th. Regards, Rod |