public static < T > T queryBean ( String poolName , String sql , Class < T > beanType , Object [ ] params ) throws YankSQLException { T returnObject = null ; try { BeanHandler < T > resultSetHandler = new BeanHandler < T > ( beanType , new BasicRowProcessor ( new YankBeanProcessor < T > ( beanType ) ) ) ; returnObject = new QueryRunner ( YANK_POOL_MANAGER . getConnectionPool ( poolName ) ) . query ( sql , resultSetHandler , params ) ; } catch ( SQLException e ) { handleSQLException ( e , poolName , sql ) ; } return returnObject ; }
Return just one Bean given an SQL statement . If more than one row match the query only the first row is returned .