Example #1
0
 public <V> V executeScalar(Converter<V> converter) {
   try {
     //noinspection unchecked
     return converter.convert(executeScalar());
   } catch (ConverterException e) {
     throw new Sql2oException("Error occured while converting value from database", e);
   }
 }
Example #2
0
 public <V> V executeScalar(Class returnType) {
   Object value = executeScalar();
   Converter converter = null;
   try {
     converter = Convert.getConverter(returnType);
     return (V) converter.convert(value);
   } catch (ConverterException e) {
     throw new Sql2oException(
         "Error occured while converting value from database to type " + returnType.toString(), e);
   }
 }