diff --git a/src/org/dbflute/erflute/editor/model/dbimport/ImportFromDBManagerBase.java b/src/org/dbflute/erflute/editor/model/dbimport/ImportFromDBManagerBase.java index f624c03..d5aa870 100644 --- a/src/org/dbflute/erflute/editor/model/dbimport/ImportFromDBManagerBase.java +++ b/src/org/dbflute/erflute/editor/model/dbimport/ImportFromDBManagerBase.java @@ -346,7 +346,25 @@ tableProperties.setSchema(schema); table.setPhysicalName(tableName); - final String description = tableCommentMap.get(tableNameWithSchema); + + // テーブルコメントの取得 - キーの正規化対応 + String description = tableCommentMap.get(tableNameWithSchema); + if (description == null) { + // ダブルクォーテーションを除去したキーでも検索 + String normalizedKey = normalizeTableKey(tableNameWithSchema); + description = tableCommentMap.get(normalizedKey); + + // それでも見つからない場合は、tableCommentMapの全キーに対して正規化比較 + if (description == null) { + for (Map.Entry entry : tableCommentMap.entrySet()) { + if (normalizeTableKey(entry.getKey()).equals(normalizedKey)) { + description = entry.getValue(); + break; + } + } + } + } + //description = ID:ID if (useCommentAsLogicalName && !Check.isEmpty(description)) { final int pos = description.indexOf(':'); @@ -1164,6 +1182,19 @@ return size; } + /** + * テーブルキーを正規化(ダブルクォーテーション除去) + * @param tableKey テーブルキー + * @return 正規化されたテーブルキー + */ + protected String normalizeTableKey(String tableKey) { + if (tableKey == null) { + return null; + } + // ダブルクォーテーションを除去 + return tableKey.replaceAll("\"", ""); + } + protected void close(ResultSet rs) throws SQLException { if (rs != null) { rs.close();