SimpleDbViewModelService implements WteModelService { @Override public Map<String, Class<?>> listModelElements(Class<?> inputClass, Map<String, String> properties) { Map<String, Class<?>> elements = new HashMap<String, Class<?>>(); String viewName = properties.get(VIEW_NAME); Connection connection = null; ResultSet rs = null; try { try { connection = ds.getConnection(); DatabaseMetaData metaData = ds.getConnection().getMetaData(); rs = metaData.getColumns(null, null, viewName, null); while (rs.next()) { String columnName = rs.getString("COLUMN_NAME") .toLowerCase(); Class<?> type = MapperSqlType.map(rs.getInt("DATA_TYPE")); elements.put(columnName, type); } } finally { if (rs != null) { rs.close(); } if (connection != null) { connection.close(); } } } catch (SQLException e) { throw new WteException("error in view " + viewName, e); } return elements; } protected  SimpleDbViewModelService();  SimpleDbViewModelService(DataSource aDs); @Override Map<String, Class<?>> listModelElements(Class<?> inputClass,
			Map<String, String> properties); @Override List<String> listRequiredModelProperties(); @Override WteDataModel createModel(Template<?> template, Object input); static final String VIEW_NAME; static final String PRIMARY_KEY_COLUMN_NAME; }
@Test public void testModelElements() throws SQLException { SimpleDbViewModelService ms = new SimpleDbViewModelService(ds); Map<String, String> modelProperties = new HashMap<String, String>(); modelProperties.put(SimpleDbViewModelService.VIEW_NAME, "TESTDBVIEW"); modelProperties.put(SimpleDbViewModelService.PRIMARY_KEY_COLUMN_NAME, "ID"); Map<String, Class<?>> list = ms .listModelElements(null, modelProperties); assertTrue(list.size() > 0); }