On 25 November 2011 17:59, Bill Speirs <bill.spe...@gmail.com> wrote: > On Fri, Nov 25, 2011 at 12:28 PM, sebb <seb...@gmail.com> wrote: >>> As we discussed before, this exception will be thrown if the column >>> type doesn't match the generic type. Because of type erasure I don't >>> know of any way to validate the types. >> >> What determines the column type? > > As far as I know, the column type is determined by the table schema > for the datbase, and the JDBC driver. > >> If the user codes correctly to the API, is it possible for the CCE to be >> thrown? > > If the user properly matches the generic with what is in the table > schema, a CCE should not be thrown. > >> Part of the idea of generics is to do away with unnecessary casts and >> instanceof checks; adding inappropriate @SuppressWarnings tags negates >> the benefit (and can even make things worse). > > Because we only have the getObject method (there are other JDBC > methods; however, we cannot pick the correct method because of type > erasure), there will need to be a cast. However, this cast is done by > the library, so the user is not forced to cast.
OK. So we can document as follows (or similar) * @throws CCE if the class datatype does not match the column type // We assume that the user has picked the correct type to match the column // so getObject will return the appropriate type and the cast will succeed. @SuppressWarnings... > Bill- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org