List of usage examples for org.apache.commons.dbutils.handlers BeanMapHandler BeanMapHandler
public BeanMapHandler(Class<V> type, String columnName)
From source file:epgtools.epgdbbean.bean.channel.ChannelGetter.java
/** * DB?????????/*from w w w . j a v a 2s . co m*/ * * @return ??????(??) ????? * @throws java.sql.SQLException */ public synchronized Map<Integer, Useablechannels_ReadOnly> getChannels() throws SQLException { //? Map<Integer, Useablechannels> Channels; Channels = Collections.synchronizedMap(runner.query(con, ChannelGetter.GET_CHANNELS, new BeanMapHandler<Integer, Useablechannels>(Useablechannels.class, "channel_no"))); Map<Integer, Useablechannels_ReadOnly> Channels_Ro; Channels_Ro = Collections.synchronizedMap(new TreeMap<Integer, Useablechannels_ReadOnly>()); Channels_Ro.putAll(Channels); return Collections.unmodifiableMap(Channels_Ro); }
From source file:jdao.JDAO.java
public <K, V> Map<K, V> queryForBeanMap(String sql, Class<K> idClazz, Class<V> beanClazz, Object... args) throws Exception { BeanMapHandler<K, V> handler = new BeanMapHandler<K, V>(beanClazz, IBean.class.isAssignableFrom(beanClazz) ? new BasicRowProcessor(IBeanProcessor.of(beanClazz)) : this.generousRowProcessor); return this.queryForT(this.getDbType(), handler, this.getConnection(), this.getQueryRunner(), sql, args); }
From source file:jdao.JDAO.java
public <K, V> Map<K, V> queryForBeanMap(String sql, Class<K> idClazz, Class<V> beanClazz) throws Exception { BeanMapHandler<K, V> handler = new BeanMapHandler<K, V>(beanClazz, IBean.class.isAssignableFrom(beanClazz) ? new BasicRowProcessor(IBeanProcessor.of(beanClazz)) : this.generousRowProcessor); return this.queryForT(this.getDbType(), handler, this.getConnection(), this.getQueryRunner(), sql); }