/** * Compare columns created from metadata with declared columns and return a * reconciled list. * * @param declaredColumns * declared column names * @param generatedKeyNames * names of generated key columns */ protected List<String> reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames) { if (declaredColumns.size() > 0) { return new ArrayList<String>(declaredColumns); } Set<String> keys = new HashSet<String>(generatedKeyNames.length); for (String key : generatedKeyNames) { keys.add(key.toUpperCase()); } List<String> columns = new ArrayList<String>(); for (TableParameterMetaData meta : metaDataProvider.getTableParameterMetaData()) { if (!keys.contains(meta.getParameterName().toUpperCase())) { columns.add(meta.getParameterName()); } } return columns; }
/** * Compare columns created from metadata with declared columns and return a * reconciled list. * * @param declaredColumns * declared column names * @param generatedKeyNames * names of generated key columns */ protected List<String> reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames) { if (declaredColumns.size() > 0) { return new ArrayList<String>(declaredColumns); } Set<String> keys = new HashSet<String>(generatedKeyNames.length); for (String key : generatedKeyNames) { keys.add(key.toUpperCase()); } List<String> columns = new ArrayList<String>(); for (TableParameterMetaData meta : metaDataProvider .getTableParameterMetaData()) { if (!keys.contains(meta.getParameterName().toUpperCase())) { columns.add(meta.getParameterName()); } } return columns; }
private Map<String, Integer> sqlTypes() { TableMetaDataProvider metaDataProvider = TableMetaDataProviderFactory.createMetaDataProvider( jdbcTemplate.getDataSource(), tableMetaDataContext, jdbcTemplate.getNativeJdbcExtractor()); Map<String, Integer> result = new HashMap<>(); for (TableParameterMetaData parameterMetaData : metaDataProvider.getTableParameterMetaData()) { result.put(parameterMetaData.getParameterName(), parameterMetaData.getSqlType()); } return result; }
public List<String> createColumns() { List<TableParameterMetaData> tableParameterMetaDataList = this.metaDataProvider.getTableParameterMetaData(); List<String> columnList = new ArrayList<String>(tableParameterMetaDataList.size()); for (TableParameterMetaData tableParameterMetaData : tableParameterMetaDataList) { columnList.add(tableParameterMetaData.getParameterName()); } return columnList; }
public List<String> createColumns() { List<TableParameterMetaData> tableParameterMetaDataList = this.metaDataProvider .getTableParameterMetaData(); List<String> columnList = new ArrayList<String>( tableParameterMetaDataList.size()); for (TableParameterMetaData tableParameterMetaData : tableParameterMetaDataList) { columnList.add(tableParameterMetaData.getParameterName()); } return columnList; }