diff --git a/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java b/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java index 3079c7f..603a086 100644 --- a/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java +++ b/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java @@ -19,7 +19,7 @@ public class StandardSqlMaker implements SqlMaker { private static ConcurrentHashMap, StandardPojoInfo> map = new ConcurrentHashMap<>(); - public StandardPojoInfo getPojoInfo(Class rowClass) { + public synchronized StandardPojoInfo getPojoInfo(Class rowClass) { StandardPojoInfo pi = map.get(rowClass); if (pi == null) { pi = new StandardPojoInfo(rowClass); @@ -69,7 +69,7 @@ public Object[] getUpdateArgs(Query query, Object row) { args[i] = pojoInfo.getValue(row, pojoInfo.updateColumnNames[i]); } // add the value for the where clause to the end - for(int i = 0; i 0) { buf.append(" and "); } @@ -235,7 +239,7 @@ public String getCreateTableSql(Class clazz) { if (pojoInfo.primaryKeyNames.size() > 0) { buf.append(", primary key ("); - for(int i = 0; i < pojoInfo.primaryKeyNames.size(); i++){ + for (int i = 0; i < pojoInfo.primaryKeyNames.size(); i++) { if (i > 0) { buf.append(","); } @@ -295,7 +299,7 @@ public String getDeleteSql(Query query, Object row) { StringBuilder builder = new StringBuilder("delete from "); builder.append(table).append(" where "); - for(int i = 0; i < pojoInfo.primaryKeyNames.size(); i++){ + for (int i = 0; i < pojoInfo.primaryKeyNames.size(); i++) { if (i > 0) { builder.append(" and "); } @@ -310,7 +314,7 @@ public Object[] getDeleteArgs(Query query, Object row) { StandardPojoInfo pojoInfo = getPojoInfo(row.getClass()); Object[] args = new Object[pojoInfo.primaryKeyNames.size()]; - for(int i = 0; i < pojoInfo.primaryKeyNames.size(); i++) { + for (int i = 0; i < pojoInfo.primaryKeyNames.size(); i++) { Object primaryKeyValue = pojoInfo.getValue(row, pojoInfo.primaryKeyNames.get(i)); args[i] = primaryKeyValue; }