Search in sources :

Example 6 with DfPropertySettingTableNotFoundException

use of org.dbflute.exception.DfPropertySettingTableNotFoundException in project dbflute-core by dbflute.

the class DfAdditionalForeignKeyInitializer method assertForeignTable.

protected void assertForeignTable(String foreignKeyName, String foreignTableName) {
    if (getTable(foreignTableName) != null) {
        return;
    }
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found table by the foreignTableName of additionalForeignKey.");
    br.addItem("Advice");
    br.addElement("Make sure your additionalForeignKeyMap.dfprop");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("     ; FK_MEMBER_MEMBER_ADDRESS_VALID = map:{");
    br.addElement("         ; localTableName = ... ; foreignTableName = NOEXISTING_ADDRESS // *NG");
    br.addElement("         ; localColumnName = MEMBER_ID ; foreignColumnName = MEMBER_ID");
    br.addElement("         ...");
    br.addElement("     }");
    br.addElement("  (o):");
    br.addElement("     ; FK_MEMBER_MEMBER_ADDRESS_VALID = map:{");
    br.addElement("         ; localTableName = ... ; foreignTableName = MEMBER_ADDRESS     // OK");
    br.addElement("         ; localColumnName = MEMBER_ID ; foreignColumnName = MEMBER_ID");
    br.addElement("         ...");
    br.addElement("     }");
    br.addElement("");
    br.addElement("Or remove it if the table is deleted from your schema.");
    br.addItem("Additional FK");
    br.addElement(foreignKeyName);
    br.addItem("NotFound Table");
    br.addElement(foreignTableName);
    final String msg = br.buildExceptionMessage();
    throw new DfPropertySettingTableNotFoundException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfPropertySettingTableNotFoundException(org.dbflute.exception.DfPropertySettingTableNotFoundException)

Aggregations

DfPropertySettingTableNotFoundException (org.dbflute.exception.DfPropertySettingTableNotFoundException)6 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)4 DfTableMeta (org.dbflute.logic.jdbc.metadata.info.DfTableMeta)2