diff --git a/pom.xml b/pom.xml index f85f332..5db1066 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cz.foresttech ForestDatabase - 1.0.6 + 1.0.7 17 diff --git a/src/main/java/cz/foresttech/database/DatabaseEntityConvertor.java b/src/main/java/cz/foresttech/database/DatabaseEntityConvertor.java index 0cb5d3f..0a80015 100644 --- a/src/main/java/cz/foresttech/database/DatabaseEntityConvertor.java +++ b/src/main/java/cz/foresttech/database/DatabaseEntityConvertor.java @@ -234,8 +234,8 @@ public String generateCreateScript(Class clazz) { * @return a string representing a part of SQL script. */ private String processDeleteConditionScript(Class clazz, T object) throws IllegalAccessException { - List keys = new ArrayList<>(); - List values = new ArrayList<>(); + StringBuilder keys = new StringBuilder(); + StringBuilder values = new StringBuilder(); for (Field field : clazz.getDeclaredFields()) { field.setAccessible(true); @@ -251,12 +251,15 @@ private String processDeleteConditionScript(Class clazz, T object) throws DatabaseValueProcessor valueProcessor = databaseAPI.getProcessor(field.getType()); String processedValue = processFieldValue(fieldValue, valueProcessor); - keys.add(dbName); - values.add(processedValue); + keys.append(dbName).append(","); + values.append(processedValue).append(","); } if (keys.isEmpty()) return ""; + keys.setLength(keys.length() - 1); + values.setLength(values.length() - 1); + return "(" + keys + ") = (" + values + ")"; }