Skip to content

Commit 4dd6ca0

Browse files
author
Igor Polevoy
committed
#570 Using class instance breaks metadata lookup under a different class loader
1 parent 016035e commit 4dd6ca0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

activejdbc/src/main/java/org/javalite/activejdbc/MetaModels.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ Class<? extends Model> getModelClass(String tableName) {
6969
}
7070

7171
String getTableName(Class<? extends Model> modelClass) {
72-
MetaModel mm = metaModelsByClass.get(modelClass);
72+
MetaModel mm = null;
73+
for (Class<? extends Model> clazz: metaModelsByClass.keySet()){
74+
if(modelClass.getName().equals(clazz.getName())){
75+
mm = metaModelsByClass.get(clazz);
76+
}
77+
}
7378
return mm == null ? null : mm.getTableName();
7479
}
7580

activejdbc/src/test/java/org/javalite/activejdbc/LogValuesSpec.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public void shouldPrintJsonLogValuesAndParams(){
3434
String log = SystemStreamUtil.getSystemErr();
3535
SystemStreamUtil.restoreSystemErr();
3636

37+
System.out.println(log);
3738
//Lets test what was logged.
3839
String[] parts = log.split("LazyList -");
3940
String json = parts[1];

0 commit comments

Comments
 (0)