From a956f5143e6a6f58cc9eea8b66488bf82a558b09 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Thu, 11 Apr 2019 14:45:42 +0200 Subject: [PATCH] Add debug infos in ORM table initialisation --- src/main/java/fr/pandacube/java/util/orm/ORM.java | 4 ++-- src/main/java/fr/pandacube/java/util/orm/SQLFKField.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/pandacube/java/util/orm/ORM.java b/src/main/java/fr/pandacube/java/util/orm/ORM.java index 85fbe70..48b9416 100644 --- a/src/main/java/fr/pandacube/java/util/orm/ORM.java +++ b/src/main/java/fr/pandacube/java/util/orm/ORM.java @@ -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); } diff --git a/src/main/java/fr/pandacube/java/util/orm/SQLFKField.java b/src/main/java/fr/pandacube/java/util/orm/SQLFKField.java index 09289de..3e5009e 100644 --- a/src/main/java/fr/pandacube/java/util/orm/SQLFKField.java +++ b/src/main/java/fr/pandacube/java/util/orm/SQLFKField.java @@ -52,9 +52,9 @@ public class SQLFKField, T, P extends SQLElement

> 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; }