Add debug infos in ORM table initialisation

This commit is contained in:
Marc Baloup 2019-04-11 14:45:42 +02:00
parent a6f126bcc7
commit a956f5143e
2 changed files with 4 additions and 4 deletions

View File

@ -41,11 +41,11 @@ public final class ORM {
if (tables.contains(elemClass)) return;
try {
tables.add(elemClass);
//Log.info("Start Init SQL table "+elemClass.getSimpleName());
Log.info("[ORM] Start Init SQL table "+elemClass.getSimpleName());
E instance = elemClass.newInstance();
String tableName = instance.tableName();
if (!tableExist(tableName)) createTable(instance);
//Log.info("End init SQL table "+elemClass.getSimpleName());
Log.info("[ORM] End init SQL table "+elemClass.getSimpleName());
} catch (Exception|ExceptionInInitializerError e) {
throw new ORMInitTableException(elemClass, e);
}

View File

@ -52,9 +52,9 @@ public class SQLFKField<F extends SQLElement<F>, T, P extends SQLElement<P>> ext
throw new RuntimeException(e);
}
if (!fkEl.equals(fkF.getSQLElementType()))
throw new IllegalArgumentException("foreignKeyField must be from supplied foreignKeyElement");
throw new IllegalArgumentException("foreignKeyField (" + fkF.getSQLElementType().getName() + ") must be from supplied foreignKeyElement (" + fkEl.getName() + ")");
if (!type.equals(fkF.type))
throw new IllegalArgumentException("foreignKeyField and current Field must have the same SQLType");
throw new IllegalArgumentException("foreignKeyField (" + fkF.type.sqlDeclaration + ") and current Field (" + type.sqlDeclaration + ") must have the same SQLType");
sqlPrimaryKeyField = fkF;
sqlForeignKeyElemClass = fkEl;
}